mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-20 05:11:45 +08:00
option_parser: return 0 when requesting help or version
This commit is contained in:
parent
b1c6d4864f
commit
767039c492
|
@ -129,7 +129,8 @@ namespace l
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
l::read_config(data_,is);
|
l::read_config(data_,is);
|
||||||
|
if(is.fail())
|
||||||
|
data_->errs->push_back("failure reading config file");
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -426,17 +427,13 @@ option_processor(void *data_,
|
||||||
|
|
||||||
case MERGERFS_OPT_HELP:
|
case MERGERFS_OPT_HELP:
|
||||||
usage();
|
usage();
|
||||||
close(2);
|
exit(0);
|
||||||
dup(1);
|
|
||||||
fuse_opt_add_arg(outargs_,"-ho");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MERGERFS_OPT_VERSION:
|
case MERGERFS_OPT_VERSION:
|
||||||
std::cout << "mergerfs version: "
|
std::cout << "mergerfs version: "
|
||||||
<< (MERGERFS_VERSION[0] ? MERGERFS_VERSION : "unknown")
|
<< (MERGERFS_VERSION[0] ? MERGERFS_VERSION : "unknown")
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
fuse_opt_add_arg(outargs_,"--version");
|
exit(0);
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -470,6 +467,11 @@ namespace options
|
||||||
opts,
|
opts,
|
||||||
::option_processor);
|
::option_processor);
|
||||||
|
|
||||||
|
if(config_->branches.vec.empty())
|
||||||
|
errs_->push_back("branches not set");
|
||||||
|
if(config_->mount->empty())
|
||||||
|
errs_->push_back("mountpoint not set");
|
||||||
|
|
||||||
set_default_options(args_);
|
set_default_options(args_);
|
||||||
set_fsname(args_,config_);
|
set_fsname(args_,config_);
|
||||||
set_subtype(args_);
|
set_subtype(args_);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user