Added longopts to tuxrecord2.
This commit is contained in:
parent
330631997b
commit
e585472da0
2 changed files with 25 additions and 20 deletions
25
src/main.rs
25
src/main.rs
|
|
@ -84,12 +84,12 @@ fn usage() {
|
|||
\x20 tuxrecord2 [options]\n\
|
||||
\n\
|
||||
OPTIONS\n\
|
||||
\x20 -o <dir> Output directory (default: current directory)\n\
|
||||
\x20 -d <secs> Stop automatically after <secs> seconds (default: until q or Ctrl+C)\n\
|
||||
\x20 -p <prefix> Filename prefix instead of \"{prefix}\" (default: {prefix})\n\
|
||||
\x20 -D <device> ALSA capture device (default: \"{device}\")\n\
|
||||
\x20 -f, --format F Output format: {formats} (default: {format})\n\
|
||||
\x20 -h, --help Show this help\n\
|
||||
\x20 -o, --output <dir> Output directory (default: current directory)\n\
|
||||
\x20 -d, --duration <secs> Stop automatically after <secs> seconds (default: until q or Ctrl+C)\n\
|
||||
\x20 -p, --prefix <prefix> Filename prefix instead of \"{prefix}\" (default: {prefix})\n\
|
||||
\x20 -D, --device <device> ALSA capture device (default: \"{device}\")\n\
|
||||
\x20 -f, --format <fmt> Output format: {formats} (default: {format})\n\
|
||||
\x20 -h, --help Show this help\n\
|
||||
\n\
|
||||
The file is written as <prefix>__<timestamp>.<ext> where <ext> is wav, flac, or mp3.\n\
|
||||
\n\
|
||||
|
|
@ -425,8 +425,9 @@ fn timestamp() -> String {
|
|||
/*
|
||||
* Program entry point: parse options, record audio, encode the output.
|
||||
*
|
||||
* Parses the command line (-o dir, -d seconds, -p prefix, -D device,
|
||||
* -f/--format, -h/--help), validates the output directory, builds the
|
||||
* Parses the command line (-o/--output dir, -d/--duration seconds,
|
||||
* -p/--prefix prefix, -D/--device device, -f/--format, -h/--help),
|
||||
* validates the output directory, builds the
|
||||
* output filename "<dir>/<prefix>__<timestamp>.<ext>" and opens the ALSA
|
||||
* capture device and the output encoder. It then installs SIGINT/SIGTERM
|
||||
* handlers and runs a poll() loop that reads captured PCM frames from ALSA
|
||||
|
|
@ -449,7 +450,7 @@ fn run() -> i32 {
|
|||
let mut i = 1;
|
||||
while i < args.len() {
|
||||
match args[i].as_str() {
|
||||
"-o" => {
|
||||
"-o" | "--output" => {
|
||||
i += 1;
|
||||
if i >= args.len() {
|
||||
usage();
|
||||
|
|
@ -457,7 +458,7 @@ fn run() -> i32 {
|
|||
}
|
||||
output_dir = args[i].clone();
|
||||
}
|
||||
"-d" => {
|
||||
"-d" | "--duration" => {
|
||||
i += 1;
|
||||
if i >= args.len() {
|
||||
usage();
|
||||
|
|
@ -471,7 +472,7 @@ fn run() -> i32 {
|
|||
}
|
||||
}
|
||||
}
|
||||
"-p" => {
|
||||
"-p" | "--prefix" => {
|
||||
i += 1;
|
||||
if i >= args.len() || args[i].is_empty() {
|
||||
usage();
|
||||
|
|
@ -479,7 +480,7 @@ fn run() -> i32 {
|
|||
}
|
||||
prefix = args[i].clone();
|
||||
}
|
||||
"-D" => {
|
||||
"-D" | "--device" => {
|
||||
i += 1;
|
||||
if i >= args.len() || args[i].is_empty() {
|
||||
usage();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue