Skip to content

Commit

Permalink
Argument parsing: Switch from docopt to clap
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn committed Mar 7, 2020
1 parent a9fa0c7 commit 2e9f2c6
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 126 deletions.
103 changes: 90 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ path = "src/main.rs"
[dependencies]
ansi_term = "0.12.0"
app_dirs = "1.2.1"
docopt = "1"
clap = { git = "https://github.com/clap-rs/clap/" }
env_logger = { version = "0.7", optional = true }
flate2 = "1"
log = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion bash_tealdeer
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _tealdeer()
return
;;
-o|--os)
COMPREPLY=( $(compgen -W 'linux osx sunos windows' -- "${cur}") )
COMPREPLY=( $(compgen -W 'linux osx macos sunos windows' -- "${cur}") )
return
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion fish_tealdeer
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ complete -c tldr -s h -l help -d 'Print the help message.' -f
complete -c tldr -s v -l version -d 'Show version information.' -f
complete -c tldr -s l -l list -d 'List all commands in the cache.' -f
complete -c tldr -s f -l render -d 'Render a specific markdown file.' -r
complete -c tldr -s o -l os -d 'Override the operating system.' -xa 'linux osx sunos windows other'
complete -c tldr -s o -l os -d 'Override the operating system.' -xa 'linux osx macos sunos windows'
complete -c tldr -s u -l update -d 'Update the local cache.' -f
complete -c tldr -s c -l clear-cache -d 'Clear the local cache.' -f
complete -c tldr -s p -l pager -d 'Use a pager to page output.' -f
Expand Down
1 change: 0 additions & 1 deletion src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ impl Cache {
OsType::OsX => Some("osx"),
OsType::SunOs => None, // TODO: Does Rust support SunOS?
OsType::Windows => Some("windows"),
OsType::Other => None,
}
}

Expand Down
Loading

0 comments on commit 2e9f2c6

Please sign in to comment.