Skip to content

Commit

Permalink
Custom replacement comment text (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
RFBomb authored Jun 25, 2023
1 parent 4a80f0a commit d1ae3cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::things::ThingType;
use crate::things::{ThingType, LOREM_IPSUM};
use chrono::{DateTime, Utc};
use clap::Parser;
use std::path::PathBuf;
Expand Down Expand Up @@ -40,6 +40,10 @@ pub struct Config {
#[clap(long, env = "SHREDDIT_MAX_SCORE")]
pub max_score: Option<i64>,

/// Allows a user to specify a custom string as their comment replacement text
#[clap(short, long, env = "SHREDDIT_REPLACEMENT_COMMENT", default_value = LOREM_IPSUM)]
pub replacement_comment: String,

/// The User-Agent for Reddit API requests.
#[clap(
long,
Expand Down
3 changes: 1 addition & 2 deletions src/things/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use super::Shred;
use crate::{
cli::Config,
sources::{api::Api, gdpr::Gdpr},
things::LOREM_IPSUM,
};
use async_stream::stream;
use async_trait::async_trait;
Expand Down Expand Up @@ -112,7 +111,7 @@ impl Shred for Comment {

let params = HashMap::from([
("thing_id", self.fullname()),
("text", LOREM_IPSUM.to_string()),
("text", config.replacement_comment.to_string()),
]);

let res: EditResponse = client
Expand Down
2 changes: 1 addition & 1 deletion src/things/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ where
thing.delete(client, access_token, config).await;
}

static LOREM_IPSUM: &str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
pub static LOREM_IPSUM: &str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

#[derive(Debug)]
pub enum ShredditError {
Expand Down

0 comments on commit d1ae3cd

Please sign in to comment.