Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Commit

Permalink
Format options
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Jul 25, 2021
1 parent 2e5f0d0 commit c80afb0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 14 deletions.
28 changes: 14 additions & 14 deletions docs/Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ Usage:
pcloudcc [options] [--] [arguments]

Options:
-k,--commands-only Daemon already started pass only commands
-d,--daemonize Daemonize the process
-u,--username TEXT pCloud account name
-p,--password Ask pCloud account password
-c,--crypto Ask crypto password
-y,--passascrypto Use user password as crypto password also
-m,--mountpoint TEXT Mount point where drive to be mounted
-n,--newuser Use if this is a new user to be registered
-o,--commands Parent stays alive and processes commands
-s,--savepassword Save password in database
-V,--version Print client version information and quit
--vernum Print the version of the client as integer and quit
--dumpversion Print the version of the client and don't do anything else
-h,--help Print this help message and quit
-k, --commands-only Daemon already started pass only commands
-d, --daemonize Daemonize the process
-u, --username arg pCloud account name
-p, --password Ask pCloud account password
-c, --crypto Ask crypto password
-y, --passascrypto Use user password as crypto password also
-m, --mountpoint arg Mount point where drive to be mounted
-n, --newuser Use if this is a new user to be registered
-o, --commands Parent stays alive and processes commands
-s, --savepassword Save password in database
-V, --version Print client version information and quit
--vernum Print the version of the client as integer and quit
--dumpversion Print the version of the client and don't do anything else
-h, --help Print this help message and quit
```
Expand Down
25 changes: 25 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,30 @@ class PcloudFormatter : public CLI::Formatter {

return out;
}

std::string make_option_name(const CLI::Option *opt, bool is_positional) const override {
std::string name;
if(is_positional)
name = opt->get_name(true, false);
else
name = opt->get_name(false, true);

std::string new_name;
if (name[0] == '-' && name[1] == '-') {
new_name = " " + name;
} else {
for(char i : name) {
if(i != ',')
new_name += i;
else {
new_name += i;
new_name += " ";
}
}
}

return new_name;
}
};

int main(int argc, char** argv) {
Expand All @@ -89,6 +113,7 @@ int main(int argc, char** argv) {
app.get_formatter()->column_width(26);
app.get_formatter()->label("OPTIONS", "options");
app.get_formatter()->label("ARGUMENTS", "arguments");
app.get_formatter()->label("TEXT", "arg");

// Global flag & options

Expand Down

0 comments on commit c80afb0

Please sign in to comment.