Skip to content

Commit

Permalink
More regular argument parsing
Browse files Browse the repository at this point in the history
More heavily based on the Fuchsia guidelines this time.
https://fuchsia.dev/fuchsia-src/concepts/api/cli
https://fuchsia.dev/fuchsia-src/concepts/api/cli_help

wheee, shell verbosity.
  • Loading branch information
bb010g committed May 23, 2021
1 parent ab4dd70 commit bc491bf
Show file tree
Hide file tree
Showing 3 changed files with 465 additions and 208 deletions.
99 changes: 66 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,77 +30,107 @@ $ chmod +x betterdiscordctl
You can then keep `betterdiscordctl` up to date with one command:

```
# betterdiscordctl upgrade
# betterdiscordctl self-upgrade
```

## Options

* `-V` / `--version`
betterdiscordctl (mostly) follows the Fuchsia
[command-line tools rubric's execution section][fuchsia-cli-execution] and
[CLI tool help requirements][fuchsia-cli_help].

[fuchsia-cli-execution]: https://fuchsia.dev/fuchsia-src/concepts/api/cli#execution
[fuchsia-cli_help]: https://fuchsia.dev/fuchsia-src/concepts/api/cli_help

* `-V`, `--version`

Displays the current version.

* `-h` / `--help`
* `-h`, `--help`

Displays usage information.

* `-v` / `--verbose`
* `-v`, `--verbose`

Increases the verbosity level, for progressively more debugging information.

* `-q` / `--quiet`
* `-q`, `--quiet`

Decreases the verbosity level, for progressively less debugging information.

* `-f` / `--flavors` (default `:canary:ptb`)
* `-f`, `--d-flavors` `<d_flavors>` (default `:canary:ptb`)

When scanning, looks for installations with the given suffixes (case
insensitive, both hyphenated and unhyphenated). Stable is `''`, as it has no
suffix. Note that **no** spaces follow colons. Your Discord flavor probably
doesn't have a space in it, so don't use any in here.

* `-m` / `--modules`
Flavors besides `''` are only relevant to traditional Discord installations.

* `-m`, `--d-modules` `<d_modules>`

Disregards scanning results and uses the specified modules directory (found
inside Discord's user-specific storage directory).

* `-r` / `--bd-repo` (default `rauenzi/BetterDiscordApp`)
* `-D`, `--bd-remote-dir` `<bd_r_dir>`

When installing BetterDiscord, use the specified local directory. Overrides
earlier `--bd-remote-url` or `--bd-remote-github`. `''` keeps a previous
value.

* `-U`, `--bd-remote-url` `<bd_r_url>`

When installing BetterDiscord, use the specified base URL. Overrides earlier
`--bd-remote-dir` or `--bd-remote-github`. `''` keeps a previous value.

Works like `--bd-remote-dir` with files downloaded into BetterDiscord's data
directory.

When installing BetterDiscord, use the specified GitHub repository.
Defaults to upstream BetterDiscord.
* `-H`, `--bd-remote-github` `<bd_r_github>` (default `~rauenzi/BetterDiscordApp#latest`)

* `-R` / `--bd-release` (default `latest`)
When installing BetterDiscord, use the specified GitHub repository, of form
`[~<owner>][/<repo>][#<release>]`. Defaults to upstream BetterDiscord.
Overrides earlier `--bd-remote-dir` or `--bd-remote-url`. Omitted parts keep
previous values (e.g. `-H '~rauenzi'` only changes the owner to `rauenzi`,
and `-H ''` changes nothing but still ensures the configured GitHub
repository will be used).

When downloading from `--bd-repo`, use this release.
Works like `--bd-remote-url` with a GitHub repository release download base
URL.

* `-a` / `--bd-asar`
* `--bd-remote-asar` `<bd_r_asar>`

Instead of downloading `betterdiscord.asar` from a release, use the
specified BetterDiscord asar file. This flag is mostly meant for
**developers** testing custom BetterDiscord builds.
specified BetterDiscord asar file name. This flag is mostly meant for quirky
tests of custom BetterDiscord builds.

* `--flatpak`
* `-i`, `--d-install`

Automatically detect the default Flatpak directory for Discord.
+ `traditional` (default)

* `--flatpak-bin` (default `flatpak`)
+ `flatpak`

Calls this `flatpak` executable.
Automatically detect the default Flatpak directory for Discord.

* `--snap`
+ `snap`

Automatically detect the default Snap directory for Discord.

* `--snap-bin` (default `snap`)
* `--flatpak-bin` `<flatpak>` (default `flatpak`)

Calls this `flatpak` executable.

* `--snap-bin` `<snap>` (default `snap`)

Calls this `snap` executable.

* `--upgrade-url` (default `https://github.com/bb010g/betterdiscordctl/raw/master/betterdiscordctl`)
* `--upgrade-url` `<upgrade_url>` (default `https://github.com/bb010g/betterdiscordctl/raw/master/betterdiscordctl`)

Use the specified URL for upgrading betterdiscordctl.
Use the specified URL for self-upgrading betterdiscordctl.

## Commands

### `status` (default)
### `status`

Displays information about your current BetterDiscord setup.

Expand All @@ -116,29 +146,32 @@ Reinstalls BetterDiscord, removing the old files.

Uninstalls BetterDiscord, removing the managed repository if used.

### `upgrade`
### `self-upgrade`

Upgrades `betterdiscordctl` to the latest version available on GitHub.

Updates `betterdiscordctl` to the latest version available on GitHub.
If `betterdiscordctl` is installed from a package, self-upgrading may be
disabled, in which case the package's maintainer should keep it up to date.

## Examples

* `betterdiscordctl`
* `betterdiscordctl --help`

Works like `betterdiscordctl status`.
Lists options & commands.

* `betterdiscordctl status -f ptb`
* `betterdiscordctl -f ptb status`

Shows the BetterDiscord for the PTB flavor.
Shows the BetterDiscord status for the PTB flavor.

* `betterdiscordctl install -f canary`
* `betterdiscordctl -f canary install`

Installs BetterDiscord to the Canary flavor.

* `betterdiscordctl reinstall --flatpak`
* `betterdiscordctl -i flatpak reinstall`

Reinstalls BetterDiscord to a Discord installed via Flatpak.

* `betterdiscordctl uninstall --snap`
* `betterdiscordctl -i snap uninstall`

Uninstalls BetterDiscord from a Discord installed via Snap.

Expand Down
Loading

0 comments on commit bc491bf

Please sign in to comment.