improve docs

This commit is contained in:
figsoda 2022-10-27 12:12:28 -04:00
parent 9af2e8c3c0
commit 9e72ae3155
4 changed files with 85 additions and 24 deletions

58
Cargo.lock generated
View file

@ -143,6 +143,7 @@ dependencies = [
"once_cell",
"strsim",
"termcolor",
"terminal_size",
"unicase",
"unicode-width",
]
@ -261,6 +262,27 @@ dependencies = [
"winapi",
]
[[package]]
name = "errno"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "event-listener"
version = "2.5.3"
@ -348,12 +370,24 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "io-lifetimes"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6e481ccbe3dea62107216d0d1138bb8ad8e5e5c43009a098bd1990272c497b0"
[[package]]
name = "libc"
version = "0.2.134"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb"
[[package]]
name = "linux-raw-sys"
version = "0.0.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d"
[[package]]
name = "lock_api"
version = "0.4.9"
@ -551,6 +585,20 @@ dependencies = [
"serde",
]
[[package]]
name = "rustix"
version = "0.35.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "985947f9b6423159c4726323f373be0a21bdb514c5af06a849cb3d2dce2d01e8"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]]
name = "scopeguard"
version = "1.1.0"
@ -658,6 +706,16 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "terminal_size"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8440c860cf79def6164e4a0a983bcc2305d82419177a0e0c71930d049e3ac5a1"
dependencies = [
"rustix",
"windows-sys",
]
[[package]]
name = "thiserror"
version = "1.0.37"

View file

@ -15,7 +15,6 @@ categories = ["command-line-utilities"]
anyhow = "1.0.66"
async-io = "1.9.0"
async-net = "1.7.0"
clap = { version = "4.0.18", features = ["cargo", "derive", "unicode"] }
crossbeam-queue = "0.3.6"
crossterm = "0.25.0"
dirs = "4.0.0"
@ -24,6 +23,10 @@ futures-lite = "1.12.0"
ron = "0.8.0"
serde = { version = "1.0.147", features = ["derive"] }
[dependencies.clap]
version = "4.0.18"
features = ["cargo", "derive", "unicode", "wrap_help"]
[dependencies.tui]
version = "0.19.0"
default-features = false

View file

@ -39,26 +39,23 @@ cargo build --release
## Usage
```sh
mmtc [FLAGS] [OPTIONS]
```
Usage: mmtc [OPTIONS]
flag | description
-|-
--clear-query-on-play | Clear query on play
--cycle | Cycle through the queue
-h, --help | Prints help information
--no-clear-query-on-play | Don't clear query on play
--no-cycle | Don't cycle through the queue
-V, --version | Prints version information
option | description
-|-
--address \<address> | Specify the address of the mpd server
-c, --config \<file> | Specify the config file
--jump-lines \<number> | The number of lines to jump
--seek-secs \<number> | The time to seek in seconds
--ups \<number> | The amount of status updates per second
Options:
--clear-query-on-play Clear query on play
-C, --cmd [<CMD>...] Run mpd commands and exit
--cycle Cycle through the queue
--no-clear-query-on-play Don't clear query on play
--no-cycle Don't cycle through the queue
--address <address> Specify the address of the mpd server
-c, --config <file> Specify the config file
--jump-lines <number> The number of lines to jump
--seek-secs <number> The time to seek in seconds
--ups <number> The amount of status updates per second
-h, --help Print help information (use `--help` for more detail)
-V, --version Print version information
```
## Environment variables

View file

@ -3,19 +3,22 @@ use clap::Parser;
use std::path::PathBuf;
/// Minimal mpd terminal client that aims to be simple yet highly configurable
///
/// Homepage: https://github.com/figsoda/mmtc
/// https://github.com/figsoda/mmtc
#[derive(Parser)]
#[command(version)]
#[command(version, verbatim_doc_comment)]
pub struct Opts {
/// Clear query on play
#[arg(long)]
pub clear_query_on_play: bool,
/// Run mpd commands and quit
/// Run mpd commands and exit
///
/// For example:
/// `mmtc -C next pause` will switch to the next song then toggle pause
/// `mmtc -C status` will show the current status of mpd
///
/// See https://mpd.readthedocs.io/en/latest/protocol.html for more information
#[arg(short = 'C', long, num_args = ..)]
#[arg(short = 'C', long, num_args = .., verbatim_doc_comment)]
pub cmd: Option<Vec<Vec<u8>>>,
/// Cycle through the queue