Skip to content

Commit

Permalink
Merge pull request #55 from sluedecke/clap-no-wrap
Browse files Browse the repository at this point in the history
Nicely wrap help text using clap feature "wrap_help"
  • Loading branch information
Polochon-street authored Jun 7, 2024
2 parents b63e087 + 25a19e5 commit 03fa978
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bliss-audio = "0.7.0"
mpd = "0.0.12"
dirs = "3.0.1"
tempdir = "0.3.7"
clap = "2.33.3"
clap = { version = "2.33.3", features = ["wrap_help"] }
anyhow = "1.0.58"
log = "0.4.14"
env_logger = "0.8.4"
Expand Down
43 changes: 16 additions & 27 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl MPDLibrary {

fn mpd_to_bliss_path(&self, mpd_song: &MPDSong) -> Result<PathBuf> {
let file = &mpd_song.file;
let path = if file.to_lowercase().contains(".cue/track") {
let path = if file.to_lowercase().contains(".cue/track") || file.to_lowercase().contains(".flac/track") {
let lowercase_string = file.to_lowercase();
let idx: Vec<_> = lowercase_string.match_indices("/track").collect();
let beginning_file = file.split_at(idx[0].0).0.to_owned();
Expand Down Expand Up @@ -583,8 +583,7 @@ fn main() -> Result<()> {
.short("c")
.long("config-path")
.help(
"Optional argument specifying the configuration path, for both loading \
and initializing blissify. Example: \"/path/to/config.json\".",
"Optional argument specifying the configuration path, for both loading and initializing blissify. Example: \"/path/to/config.json\".",
)
.required(false)
.takes_value(true)
Expand All @@ -608,18 +607,16 @@ fn main() -> Result<()> {
.short("d")
.long("database-path")
.help(
"Optional argument specifying where to store the database
containing analyzed songs. Example: \"/path/to/bliss.db\"",
"Optional argument specifying where to store the database containing analyzed songs. Example: \"/path/to/bliss.db\"",
)
.required(false)
.takes_value(true)
)
.arg(Arg::with_name("number-cores")
.long("number-cores")
.help(
"Number of CPU cores the analysis should use \
(defaults to the number of cores the CPU has).
Useful to avoid a too heavy load on a machine.")
"Number of CPU cores the analysis should use (defaults to the number of cores the CPU has).
Useful to avoid a too heavy load on a machine.")
.required(false)
.takes_value(true)
)
Expand All @@ -629,9 +626,8 @@ fn main() -> Result<()> {
.arg(Arg::with_name("number-cores")
.long("number-cores")
.help(
"Number of CPU cores the analysis should use \
(defaults to the number of cores the CPU has).
Useful to avoid a too heavy load on a machine.")
"Number of CPU cores the analysis should use (defaults to the number of cores the CPU has).
Useful to avoid a too heavy load on a machine.")
.required(false)
.takes_value(true)
)
Expand All @@ -642,9 +638,8 @@ fn main() -> Result<()> {
.arg(Arg::with_name("number-cores")
.long("number-cores")
.help(
"Number of CPU cores the analysis should use \
(defaults to the number of cores the CPU has).
Useful to avoid a too heavy load on a machine.")
"Number of CPU cores the analysis should use (defaults to the number of cores the CPU has).
Useful to avoid a too heavy load on a machine.")
.required(false)
.takes_value(true)
)
Expand All @@ -661,25 +656,22 @@ fn main() -> Result<()> {
.long("distance")
.value_name("distance metric")
.help(
"Choose the distance metric used to make the playlist. Default is 'euclidean',\
"Choose the distance metric used to make the playlist. Default is 'euclidean',
other option is 'cosine'"
)
.default_value("euclidean")
)
.arg(Arg::with_name("seed")
.long("seed-song")
.help(
"Instead of making a playlist of only the closest song to the current song,\
make a playlist that queues the closest song to the first song, then
the closest to the second song, etc. Can take some time to build."
"Instead of making a playlist of only the closest song to the current song, make a playlist that queues the closest song to the first song, then the closest to the second song, etc. Can take some time to build."
)
.takes_value(false)
)
.arg(Arg::with_name("dedup")
.long("deduplicate-songs")
.help(
"Deduplicate songs based both on the title / artist and their\
sheer proximity."
"Deduplicate songs based both on the title / artist and their sheer proximity."
)
.takes_value(false)
)
Expand All @@ -692,23 +684,20 @@ fn main() -> Result<()> {
.subcommand(
SubCommand::with_name("interactive-playlist")
.about(
"Make a playlist, prompting a set of close songs, \
and asking which one will be the most appropriate."
"Make a playlist, prompting a set of close songs, and asking which one will be the most appropriate."
)
.arg(Arg::with_name("continue")
.long("continue")
.help(
"Take the current playlist's last song as a starting \
point, instead of removing the current playlist and \
starting from the first song."
"Take the current playlist's last song as a starting point, instead of removing the current playlist and starting from the first song."
)
)
.arg(Arg::with_name("choices")
.long("number-choices")
.value_name("choices")
.help(
"Choose the number of proposed items you get each time. \
Defaults to 3, cannot be more than 9."
"Choose the number of proposed items you get each time.
Defaults to 3, cannot be more than 9."
)
.default_value("3")
)
Expand Down

0 comments on commit 03fa978

Please sign in to comment.