Add "macos" alias for "osx" (#215)

The Apple computer operating system was renamed from "OS X" to "macOS"
in 2016. We should accept "macos" instead of "osx" in all our CLI APIs,
and the docs should also mention this alias instead of "osx".

For backwards compatibility and for compatibility with the tldr client
specification, we should still accept "osx" though.
This commit is contained in:
Danilo Bargen 2021-12-05 16:38:35 +01:00 committed by GitHub
commit 72d753c52b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 11 deletions

View file

@ -14,7 +14,7 @@ _tealdeer()
return
;;
-p|--platform)
COMPREPLY=( $(compgen -W 'linux osx sunos windows' -- "${cur}") )
COMPREPLY=( $(compgen -W 'linux macos sunos windows' -- "${cur}") )
return
;;
--color)

View file

@ -13,10 +13,9 @@ ARGS:
OPTIONS:
-l, --list List all commands in the cache
-f, --render <FILE> Render a specific markdown file
-p, --platform <PLATFORM> Override the operating system [possible values: linux, osx, sunos,
windows]
-o, --os <OS> Deprecated alias of `platform` [possible values: linux, osx, sunos,
windows]
-p, --platform <PLATFORM> Override the operating system [possible values: linux, macos,
windows, sunos, osx]
-o, --os <OS> Deprecated alias of `platform`
-L, --language <LANGUAGE> Override the language
-u, --update Update the local cache
-c, --clear-cache Clear the local cache

View file

@ -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 p -l platform -d 'Override the operating system.' -xa 'linux osx sunos windows'
complete -c tldr -s p -l platform -d 'Override the operating system.' -xa 'linux 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

View file

@ -84,7 +84,7 @@ struct Args {
short = 'p',
long = "platform",
requires = "command",
possible_values = ["linux", "osx", "sunos", "windows"],
possible_values = ["linux", "macos", "windows", "sunos", "osx"],
)]
platform: Option<PlatformType>,
@ -93,7 +93,8 @@ struct Args {
short = 'o',
long = "os",
requires = "command",
possible_values = ["linux", "osx", "sunos", "windows"],
possible_values = ["linux", "macos", "windows", "sunos", "osx"],
hide_possible_values = true,
)]
os: Option<PlatformType>,

View file

@ -31,11 +31,11 @@ impl str::FromStr for PlatformType {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"linux" => Ok(Self::Linux),
"osx" => Ok(Self::OsX),
"osx" | "macos" => Ok(Self::OsX),
"sunos" => Ok(Self::SunOs),
"windows" => Ok(Self::Windows),
other => Err(format!(
"Unknown OS: {}. Possible values: linux, osx, sunos, windows",
"Unknown OS: {}. Possible values: linux, macos, osx, sunos, windows",
other
)),
}

View file

@ -16,7 +16,7 @@ _tealdeer() {
"($I -f --render)"{-f,--render}"[Render a specific markdown file]:file:_files"
"($I -p --platform)"{-p,--platform}'[Override the operating system]:platform:((
linux
osx
macos
sunos
windows
))'