better help message

This commit is contained in:
skilion 2015-09-22 11:20:54 +02:00
parent da2cfbde9c
commit 85cd44cf73

View file

@ -2,7 +2,6 @@ import core.memory, core.time, core.thread;
import std.getopt, std.file, std.path, std.process, std.stdio; import std.getopt, std.file, std.path, std.process, std.stdio;
import config, itemdb, monitor, onedrive, sync; import config, itemdb, monitor, onedrive, sync;
string ver = "1.0";
void main(string[] args) void main(string[] args)
{ {
@ -11,11 +10,15 @@ void main(string[] args)
auto opt = getopt( auto opt = getopt(
args, args,
"monitor|m", "Keep monitoring for local and remote changes.", &monitor, "monitor|m", "Keep monitoring for local and remote changes.", &monitor,
"resync", "Forget the local state and perform a full synchronization.", &resync, "resync", "Forget the local state and perform a full sync.", &resync,
"verbose|v", "Print more details, useful for debugging.", &verbose "verbose|v", "Print more details, useful for debugging.", &verbose
); );
if (opt.helpWanted) { if (opt.helpWanted) {
defaultGetoptPrinter("OneDrive Free Client for Linux v" ~ ver ~ "\nAvailable options:", opt.options); defaultGetoptPrinter(
"Usage: onedrive [OPTION]...\n\n" ~
"no option Sync and exit.",
opt.options
);
return; return;
} }
} catch (GetOptException e) { } catch (GetOptException e) {
@ -69,6 +72,7 @@ void main(string[] args)
} }
string syncDir = expandTilde(cfg.get("sync_dir")); string syncDir = expandTilde(cfg.get("sync_dir"));
if (verbose) writeln("All operations will be performed in: ", syncDir);
chdir(syncDir); chdir(syncDir);
performSync(sync); performSync(sync);