mirror of
https://github.com/mgree/ffs.git
synced 2024-09-11 11:15:48 +03:00
fix argument style
This commit is contained in:
parent
29536d6763
commit
a09a786ad4
34
src/main.rs
34
src/main.rs
@ -39,26 +39,16 @@ fn main() {
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("NEWLINE-ADD")
|
||||
.help("Add a newline to the end of values that don't already have them (overrides --exact)")
|
||||
Arg::with_name("NEWLINE")
|
||||
.help("Add a newline to the end of values that don't already have them")
|
||||
.long("newline")
|
||||
.default_value("false")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("NEWLINE-EXACT")
|
||||
.help("Render values exactly, with no added newlines (overrides --newline)")
|
||||
.long("exact")
|
||||
.overrides_with("NEWLINE-ADD")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("ELTNAME-PADDED")
|
||||
.help("Pad the numeric names of list elements with zeroes, for proper sorting (e.g., 00, 01, ..., 09, 10) (overrides --unpadded)")
|
||||
Arg::with_name("PADDED")
|
||||
.help("Pad the numeric names of list elements with zeroes, for proper sorting (e.g., 00, 01, ..., 09, 10)")
|
||||
.long("padded")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("ELTNAME-UNPADDED")
|
||||
.help("Use plain numbers for list elements (e.g., 0, 1, ..., 9, 10) (overrides --padded)")
|
||||
.long("unpadded")
|
||||
.overrides_with("ELTNAME-PADDED")
|
||||
.default_value("true")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("MOUNT")
|
||||
@ -83,8 +73,16 @@ fn main() {
|
||||
.with(fmt_layer)
|
||||
.init();
|
||||
|
||||
config.add_newlines = args.is_present("NEWLINE-ADD");
|
||||
config.pad_element_names = args.is_present("ELTNAME-PADDED");
|
||||
config.add_newlines = match args.value_of("NEWLINE") {
|
||||
Some("true") | None => true,
|
||||
Some("false") => false,
|
||||
Some(s) => panic!("Got `--newline {}`; please give either `true` or `false`.", s),
|
||||
};
|
||||
config.pad_element_names = match args.value_of("PADDED") {
|
||||
Some("true") | None => true,
|
||||
Some("false") => false,
|
||||
Some(s) => panic!("Got `--padded {}`; please give either `true` or `false`.", s),
|
||||
};
|
||||
let autounmount = args.is_present("AUTOUNMOUNT");
|
||||
|
||||
// TODO 2021-06-08 infer and create mountpoint from filename as possible
|
||||
|
@ -4,6 +4,7 @@ fail() {
|
||||
echo FAILED: $1
|
||||
if [ "$MNT" ]
|
||||
then
|
||||
cd
|
||||
umount "$MNT"
|
||||
rmdir "$MNT"
|
||||
fi
|
||||
|
@ -4,6 +4,7 @@ fail() {
|
||||
echo FAILED: $1
|
||||
if [ "$MNT" ]
|
||||
then
|
||||
cd
|
||||
umount "$MNT"
|
||||
rmdir "$MNT"
|
||||
fi
|
||||
|
@ -4,6 +4,7 @@ fail() {
|
||||
echo FAILED: $1
|
||||
if [ "$MNT" ]
|
||||
then
|
||||
cd
|
||||
umount "$MNT"
|
||||
rmdir "$MNT"
|
||||
rm -r "$EXP"
|
||||
@ -20,7 +21,7 @@ printf "2" >"${EXP}/eyes"
|
||||
printf "10" >"${EXP}/fingernails"
|
||||
printf "true" >"${EXP}/human"
|
||||
|
||||
ffs --exact "$MNT" ../json/object.json &
|
||||
ffs --newline false "$MNT" ../json/object.json &
|
||||
PID=$!
|
||||
sleep 1
|
||||
cd "$MNT"
|
||||
|
@ -4,6 +4,7 @@ fail() {
|
||||
echo FAILED: $1
|
||||
if [ "$MNT" ]
|
||||
then
|
||||
cd
|
||||
umount "$MNT"
|
||||
rmdir "$MNT"
|
||||
rm -r "$EXP"
|
||||
@ -20,7 +21,7 @@ printf "2\n" >"${EXP}/eyes"
|
||||
printf "10\n" >"${EXP}/fingernails"
|
||||
printf "true\n" >"${EXP}/human"
|
||||
|
||||
ffs --newline "$MNT" ../json/object.json &
|
||||
ffs --newline true "$MNT" ../json/object.json &
|
||||
PID=$!
|
||||
sleep 1
|
||||
cd "$MNT"
|
||||
|
@ -4,6 +4,7 @@ fail() {
|
||||
echo FAILED: $1
|
||||
if [ "$MNT" ]
|
||||
then
|
||||
cd
|
||||
umount "$MNT"
|
||||
rmdir "$MNT"
|
||||
fi
|
||||
|
@ -4,6 +4,7 @@ fail() {
|
||||
echo FAILED: $1
|
||||
if [ "$MNT" ]
|
||||
then
|
||||
cd
|
||||
umount "$MNT"
|
||||
rmdir "$MNT"
|
||||
fi
|
||||
|
@ -4,6 +4,7 @@ fail() {
|
||||
echo FAILED: $1
|
||||
if [ "$MNT" ]
|
||||
then
|
||||
cd
|
||||
umount "$MNT"
|
||||
rmdir "$MNT"
|
||||
fi
|
||||
|
@ -4,6 +4,7 @@ fail() {
|
||||
echo FAILED: $1
|
||||
if [ "$MNT" ]
|
||||
then
|
||||
cd
|
||||
umount "$MNT"
|
||||
rmdir "$MNT"
|
||||
fi
|
||||
@ -12,7 +13,7 @@ fail() {
|
||||
|
||||
MNT=$(mktemp -d)
|
||||
|
||||
ffs --unpadded "$MNT" ../json/list2.json &
|
||||
ffs --padded false "$MNT" ../json/list2.json &
|
||||
PID=$!
|
||||
sleep 1
|
||||
cd "$MNT"
|
||||
|
Loading…
Reference in New Issue
Block a user