From 820d65f68eb7de8f7230d919edeb87e99ce30b2e Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Tue, 20 Feb 2024 22:50:36 +0530 Subject: [PATCH 1/8] feat: add BSD platform support; chore: update workflows Signed-off-by: K.B.Dharun Krishna --- .github/dependabot.yml | 10 +++++++++ .github/workflows/ci.yml | 8 ++++---- .github/workflows/gh-pages.yml | 2 +- .github/workflows/release.yml | 22 ++++++++++---------- CHANGELOG.md | 13 ------------ completion/bash_tealdeer | 2 +- completion/fish_tealdeer | 2 +- completion/zsh_tealdeer | 3 +++ docs/src/usage.txt | 2 +- src/cache.rs | 3 +++ src/cli.rs | 2 +- src/types.rs | 37 +++++++++++++++++++++++++++++----- 12 files changed, 68 insertions(+), 38 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..c0e00fb2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "monthly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 017a3900..d8e33b9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: toolchain: [stable, 1.64.0] runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.toolchain }} @@ -32,7 +32,7 @@ jobs: name: run clippy lints runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: stable @@ -44,7 +44,7 @@ jobs: name: run rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: stable @@ -56,7 +56,7 @@ jobs: name: build docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup mdBook uses: peaceiris/actions-mdbook@v1 with: diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index dafba802..f4370ab4 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -9,7 +9,7 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup mdBook uses: peaceiris/actions-mdbook@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 52aadc69..a3ae0fc2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ jobs: create-release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Create release for tag if: startsWith(github.ref, 'refs/tags/') run: | @@ -23,7 +23,7 @@ jobs: matrix: target: ["bash", "fish", "zsh"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Upload completion if: startsWith(github.ref, 'refs/tags/') run: | @@ -39,7 +39,7 @@ jobs: matrix: target: ["MIT", "APACHE"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Upload license if: startsWith(github.ref, 'refs/tags/') run: | @@ -65,14 +65,14 @@ jobs: - arch: "arm" libc: "musleabihf" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Pull Docker image run: docker pull messense/rust-musl-cross:${{ matrix.arch }}-${{ matrix.libc }} - name: Build in Docker run: docker run --rm -i -v "$(pwd)":/home/rust/src messense/rust-musl-cross:${{ matrix.arch }}-${{ matrix.libc }} cargo build --release - name: Strip binary run: docker run --rm -i -v "$(pwd)":/home/rust/src messense/rust-musl-cross:${{ matrix.arch }}-${{ matrix.libc }} musl-strip -s /home/rust/src/target/${{ matrix.arch }}-unknown-linux-${{ matrix.libc }}/release/tldr - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: "tealdeer-linux-${{ matrix.arch }}-${{ matrix.libc }}" path: "target/${{ matrix.arch }}-unknown-linux-${{ matrix.libc }}/release/tldr" @@ -80,14 +80,14 @@ jobs: build-macos: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup toolchain uses: dtolnay/rust-toolchain@master with: toolchain: stable - name: Build run: cargo build --release --target x86_64-apple-darwin --no-default-features --features webpki-roots - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: "tealdeer-macos-x86_64" path: "target/x86_64-apple-darwin/release/tldr" @@ -95,14 +95,14 @@ jobs: build-windows: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup toolchain uses: dtolnay/rust-toolchain@master with: toolchain: stable - name: Build run: cargo build --release --target x86_64-pc-windows-msvc - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: "tealdeer-windows-x86_64-msvc" path: "target/x86_64-pc-windows-msvc/release/tldr.exe" @@ -126,8 +126,8 @@ jobs: - macos-x86_64 - windows-x86_64-msvc steps: - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 - name: Upload binary if: startsWith(github.ref, 'refs/tags/') run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index e26c4745..2f2a5544 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,6 @@ Possible log types: - `[docs]` for documentation changes. - `[chore]` for maintenance work. - ### [v1.6.1][v1.6.1] (2022-10-24) Changes: @@ -28,7 +27,6 @@ Contributors to this version: Thanks! - ### [v1.6.0][v1.6.0] (2022-10-02) It's been 9 months since the last release already! This is not a huge update @@ -77,7 +75,6 @@ Contributors to this version: Thanks! - ### [v1.5.0][v1.5.0] (2021-12-31) This is quite a big release with many new features. In the 15 months since the @@ -165,7 +162,6 @@ Thanks! Last but not least, [Niklas Mohrin][@niklasmohrin] has joined the project as co-maintainer. Thank you for your help! - ### [v1.4.1][v1.4.1] (2020-09-04) - [fixed] Syntax error in zsh completion file ([#138][i138]) @@ -178,7 +174,6 @@ Contributors to this version: Thanks! - ### [v1.4.0][v1.4.0] (2020-09-03) - [added] Configurable automatic cache updates ([#115][i115]) @@ -200,7 +195,6 @@ Contributors to this version: Thanks! - ### [v1.3.0][v1.3.0] (2020-02-28) - [added] New config option for compact output mode ([#89][i89]) @@ -226,7 +220,6 @@ Contributors to this version: Thanks! - ### [v1.2.0][v1.2.0] (2019-08-10) - [added] Add Windows support ([#77][i77]) @@ -253,7 +246,6 @@ Contributors to this version: Thanks! - ### [v1.1.0][v1.1.0] (2018-10-22) - [added] Configuration file support ([#43][i43]) @@ -271,7 +263,6 @@ Contributors to this version: Thanks! - ### [v1.0.0][v1.0.0] (2018-02-11) - [added] Include bash completions ([#34][i34]) @@ -279,23 +270,19 @@ Thanks! - [changed] Require at least Rust 1.19 to build (previous: 1.9) - [changed] Improved unit/integration testing - ### v0.4.0 (2016-11-25) - [added] Support for new page format - [changed] Update all dependencies - ### v0.3.0 (2016-08-01) - [changed] Update curl dependency - ### v0.2.0 (2016-04-16) - First crates.io release - [@0ndorio]: https://github.com/0ndorio [@aldanor]: https://github.com/aldanor [@Atul9]: https://github.com/Atul9 diff --git a/completion/bash_tealdeer b/completion/bash_tealdeer index 1fc0655b..d5420b6f 100644 --- a/completion/bash_tealdeer +++ b/completion/bash_tealdeer @@ -14,7 +14,7 @@ _tealdeer() return ;; -p|--platform) - COMPREPLY=( $(compgen -W 'linux macos sunos windows android' -- "${cur}") ) + COMPREPLY=( $(compgen -W 'linux macos sunos windows android freebsd netbsd openbsd' -- "${cur}") ) return ;; --color) diff --git a/completion/fish_tealdeer b/completion/fish_tealdeer index dcb41c3f..eb35e879 100644 --- a/completion/fish_tealdeer +++ b/completion/fish_tealdeer @@ -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 macos sunos windows android' +complete -c tldr -s p -l platform -d 'Override the operating system.' -xa 'linux macos sunos windows android freebsd netbsd openbsd' complete -c tldr -s L -l language -d 'Override the language' -x complete -c tldr -s u -l update -d 'Update the local cache.' -f complete -c tldr -l no-auto-update -d 'If auto update is configured, disable it for this run.' -f diff --git a/completion/zsh_tealdeer b/completion/zsh_tealdeer index 0d087459..fbab7499 100644 --- a/completion/zsh_tealdeer +++ b/completion/zsh_tealdeer @@ -21,6 +21,9 @@ _tealdeer() { sunos windows android + freebsd + netbsd + openbsd ))' "($I -L --language)"{-L,--language}"[Override the language settings]:lang" "($I -u --update)"{-u,--update}"[Update the local cache]" diff --git a/docs/src/usage.txt b/docs/src/usage.txt index 74b3b2eb..5ab6fd98 100644 --- a/docs/src/usage.txt +++ b/docs/src/usage.txt @@ -12,7 +12,7 @@ OPTIONS: -l, --list List all commands in the cache -f, --render Render a specific markdown file -p, --platform Override the operating system [possible values: linux, macos, - windows, sunos, osx, android] + windows, sunos, osx, android, freebsd, netbsd, openbsd] -L, --language Override the language -u, --update Update the local cache --no-auto-update If auto update is configured, disable it for this run diff --git a/src/cache.rs b/src/cache.rs index 48be75e8..f88f7ee0 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -218,6 +218,9 @@ impl Cache { PlatformType::SunOs => "sunos", PlatformType::Windows => "windows", PlatformType::Android => "android", + PlatformType::FreeBSD => "freebsd", + PlatformType::NetBSD => "netbsd", + PlatformType::OpenBSD => "openbsd", } } diff --git a/src/cli.rs b/src/cli.rs index ed71ef87..3825245e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -40,7 +40,7 @@ pub(crate) struct Args { short = 'p', long = "platform", action = ArgAction::Append, - possible_values = ["linux", "macos", "windows", "sunos", "osx", "android"], + possible_values = ["linux", "macos", "windows", "sunos", "osx", "android", "freebsd", "netbsd", "openbsd"], )] pub platforms: Option>, diff --git a/src/types.rs b/src/types.rs index f3318a92..c09943f6 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,6 +1,6 @@ //! Shared types used in tealdeer. -use std::{fmt, str}; +use std::{fmt::{self, write}, str}; use anyhow::{anyhow, Result}; use serde_derive::{Deserialize, Serialize}; @@ -14,6 +14,9 @@ pub enum PlatformType { SunOs, Windows, Android, + FreeBSD, + NetBSD, + OpenBSD, } impl fmt::Display for PlatformType { @@ -24,6 +27,9 @@ impl fmt::Display for PlatformType { Self::SunOs => write!(f, "SunOS"), Self::Windows => write!(f, "Windows"), Self::Android => write!(f, "Android"), + Self::FreeBSD => write!(f, "FreeBSD"), + Self::NetBSD => write!(f, "NetBSD"), + Self::OpenBSD => write!(f, "OpenBSD"), } } } @@ -38,8 +44,11 @@ impl str::FromStr for PlatformType { "sunos" => Ok(Self::SunOs), "windows" => Ok(Self::Windows), "android" => Ok(Self::Android), + "freebsd" => Ok(Self::FreeBSD), + "netbsd" => Ok(Self::NetBSD), + "openbsd" => Ok(Self::OpenBSD), other => Err(anyhow!( - "Unknown OS: {}. Possible values: linux, macos, osx, sunos, windows, android", + "Unknown OS: {}. Possible values: linux, macos, osx, sunos, windows, android, freebsd, netbsd, openbsd", other )), } @@ -54,9 +63,6 @@ impl PlatformType { #[cfg(any( target_os = "macos", - target_os = "freebsd", - target_os = "netbsd", - target_os = "openbsd", target_os = "dragonfly" ))] pub fn current() -> Self { @@ -73,6 +79,27 @@ impl PlatformType { Self::Android } + #[cfg(any( + target_os = "freebsd", + ))] + pub fn current() -> Self { + Self::FreeBSD + } + + #[cfg(any( + target_os = "netbsd", + ))] + pub fn current() -> Self { + Self::NetBSD + } + + #[cfg(any( + target_os = "openbsd", + ))] + pub fn current() -> Self { + Self::OpenBSD + } + #[cfg(not(any( target_os = "linux", target_os = "macos", From 06b3e7a1447ea7bae3e603fc74f750d646599328 Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Tue, 20 Feb 2024 22:58:25 +0530 Subject: [PATCH 2/8] fix: formatiing of types.rs Signed-off-by: K.B.Dharun Krishna --- src/types.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/types.rs b/src/types.rs index c09943f6..649741f3 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,6 +1,6 @@ //! Shared types used in tealdeer. -use std::{fmt::{self, write}, str}; +use std::{fmt, str}; use anyhow::{anyhow, Result}; use serde_derive::{Deserialize, Serialize}; @@ -61,10 +61,7 @@ impl PlatformType { Self::Linux } - #[cfg(any( - target_os = "macos", - target_os = "dragonfly" - ))] + #[cfg(any(target_os = "macos", target_os = "dragonfly"))] pub fn current() -> Self { Self::OsX } @@ -79,23 +76,17 @@ impl PlatformType { Self::Android } - #[cfg(any( - target_os = "freebsd", - ))] + #[cfg(any(target_os = "freebsd",))] pub fn current() -> Self { Self::FreeBSD } - #[cfg(any( - target_os = "netbsd", - ))] + #[cfg(any(target_os = "netbsd",))] pub fn current() -> Self { Self::NetBSD } - #[cfg(any( - target_os = "openbsd", - ))] + #[cfg(any(target_os = "openbsd",))] pub fn current() -> Self { Self::OpenBSD } From 015b01f9818d3b818310c166556e2ee8f9c8eacd Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Tue, 20 Feb 2024 23:10:44 +0530 Subject: [PATCH 3/8] feat: add support for common platform flag Signed-off-by: K.B.Dharun Krishna --- completion/bash_tealdeer | 2 +- completion/fish_tealdeer | 2 +- completion/zsh_tealdeer | 1 + docs/src/usage.txt | 4 ++-- src/cache.rs | 1 + src/cli.rs | 2 +- src/types.rs | 11 ++++++++++- 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/completion/bash_tealdeer b/completion/bash_tealdeer index d5420b6f..b2a3b0a5 100644 --- a/completion/bash_tealdeer +++ b/completion/bash_tealdeer @@ -14,7 +14,7 @@ _tealdeer() return ;; -p|--platform) - COMPREPLY=( $(compgen -W 'linux macos sunos windows android freebsd netbsd openbsd' -- "${cur}") ) + COMPREPLY=( $(compgen -W 'common linux macos sunos windows android freebsd netbsd openbsd' -- "${cur}") ) return ;; --color) diff --git a/completion/fish_tealdeer b/completion/fish_tealdeer index eb35e879..f6bb8c80 100644 --- a/completion/fish_tealdeer +++ b/completion/fish_tealdeer @@ -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 macos sunos windows android freebsd netbsd openbsd' +complete -c tldr -s p -l platform -d 'Override the operating system.' -xa 'common linux macos sunos windows android freebsd netbsd openbsd' complete -c tldr -s L -l language -d 'Override the language' -x complete -c tldr -s u -l update -d 'Update the local cache.' -f complete -c tldr -l no-auto-update -d 'If auto update is configured, disable it for this run.' -f diff --git a/completion/zsh_tealdeer b/completion/zsh_tealdeer index fbab7499..20905615 100644 --- a/completion/zsh_tealdeer +++ b/completion/zsh_tealdeer @@ -16,6 +16,7 @@ _tealdeer() { "($I -l --list)"{-l,--list}"[List all commands in the cache]" "($I -f --render)"{-f,--render}"[Render a specific markdown file]:file:_files" "($I -p --platform)"{-p,--platform}'[Override the operating system]:platform:(( + common linux macos sunos diff --git a/docs/src/usage.txt b/docs/src/usage.txt index 5ab6fd98..56029b8c 100644 --- a/docs/src/usage.txt +++ b/docs/src/usage.txt @@ -11,8 +11,8 @@ ARGS: OPTIONS: -l, --list List all commands in the cache -f, --render Render a specific markdown file - -p, --platform Override the operating system [possible values: linux, macos, - windows, sunos, osx, android, freebsd, netbsd, openbsd] + -p, --platform Override the operating system [possible values: common, linux, + macos, windows, sunos, osx, android, freebsd, netbsd, openbsd] -L, --language Override the language -u, --update Update the local cache --no-auto-update If auto update is configured, disable it for this run diff --git a/src/cache.rs b/src/cache.rs index f88f7ee0..acf40262 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -213,6 +213,7 @@ impl Cache { /// Return the platform directory. fn get_platform_dir(platform: PlatformType) -> &'static str { match platform { + PlatformType::Common => "common", PlatformType::Linux => "linux", PlatformType::OsX => "osx", PlatformType::SunOs => "sunos", diff --git a/src/cli.rs b/src/cli.rs index 3825245e..7fe8cdc9 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -40,7 +40,7 @@ pub(crate) struct Args { short = 'p', long = "platform", action = ArgAction::Append, - possible_values = ["linux", "macos", "windows", "sunos", "osx", "android", "freebsd", "netbsd", "openbsd"], + possible_values = ["common", "linux", "macos", "windows", "sunos", "osx", "android", "freebsd", "netbsd", "openbsd"], )] pub platforms: Option>, diff --git a/src/types.rs b/src/types.rs index 649741f3..fa1995d5 100644 --- a/src/types.rs +++ b/src/types.rs @@ -9,6 +9,7 @@ use serde_derive::{Deserialize, Serialize}; #[serde(rename_all = "lowercase")] #[allow(dead_code)] pub enum PlatformType { + Common, Linux, OsX, SunOs, @@ -22,6 +23,7 @@ pub enum PlatformType { impl fmt::Display for PlatformType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { + Self::Common => write!(f, "Common"), Self::Linux => write!(f, "Linux"), Self::OsX => write!(f, "macOS / BSD"), Self::SunOs => write!(f, "SunOS"), @@ -39,6 +41,7 @@ impl str::FromStr for PlatformType { fn from_str(s: &str) -> Result { match s { + "common" => Ok(Self::Common), "linux" => Ok(Self::Linux), "osx" | "macos" => Ok(Self::OsX), "sunos" => Ok(Self::SunOs), @@ -48,7 +51,7 @@ impl str::FromStr for PlatformType { "netbsd" => Ok(Self::NetBSD), "openbsd" => Ok(Self::OpenBSD), other => Err(anyhow!( - "Unknown OS: {}. Possible values: linux, macos, osx, sunos, windows, android, freebsd, netbsd, openbsd", + "Unknown OS: {}. Possible values: common, linux, macos, osx, sunos, windows, android, freebsd, netbsd, openbsd", other )), } @@ -91,7 +94,13 @@ impl PlatformType { Self::OpenBSD } + #[cfg(any(target_os = "common",))] + pub fn current() -> Self { + Self::Common + } + #[cfg(not(any( + target_os = "common", target_os = "linux", target_os = "macos", target_os = "freebsd", From 2eda13f1b0a5287999a8bbc1de75f91239ca58c4 Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Tue, 20 Feb 2024 17:55:41 +0000 Subject: [PATCH 4/8] Revert "feat: add support for common platform flag" This reverts commit 015b01f9818d3b818310c166556e2ee8f9c8eacd. --- completion/bash_tealdeer | 2 +- completion/fish_tealdeer | 2 +- completion/zsh_tealdeer | 1 - docs/src/usage.txt | 4 ++-- src/cache.rs | 1 - src/cli.rs | 2 +- src/types.rs | 11 +---------- 7 files changed, 6 insertions(+), 17 deletions(-) diff --git a/completion/bash_tealdeer b/completion/bash_tealdeer index b2a3b0a5..d5420b6f 100644 --- a/completion/bash_tealdeer +++ b/completion/bash_tealdeer @@ -14,7 +14,7 @@ _tealdeer() return ;; -p|--platform) - COMPREPLY=( $(compgen -W 'common linux macos sunos windows android freebsd netbsd openbsd' -- "${cur}") ) + COMPREPLY=( $(compgen -W 'linux macos sunos windows android freebsd netbsd openbsd' -- "${cur}") ) return ;; --color) diff --git a/completion/fish_tealdeer b/completion/fish_tealdeer index f6bb8c80..eb35e879 100644 --- a/completion/fish_tealdeer +++ b/completion/fish_tealdeer @@ -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 'common linux macos sunos windows android freebsd netbsd openbsd' +complete -c tldr -s p -l platform -d 'Override the operating system.' -xa 'linux macos sunos windows android freebsd netbsd openbsd' complete -c tldr -s L -l language -d 'Override the language' -x complete -c tldr -s u -l update -d 'Update the local cache.' -f complete -c tldr -l no-auto-update -d 'If auto update is configured, disable it for this run.' -f diff --git a/completion/zsh_tealdeer b/completion/zsh_tealdeer index 20905615..fbab7499 100644 --- a/completion/zsh_tealdeer +++ b/completion/zsh_tealdeer @@ -16,7 +16,6 @@ _tealdeer() { "($I -l --list)"{-l,--list}"[List all commands in the cache]" "($I -f --render)"{-f,--render}"[Render a specific markdown file]:file:_files" "($I -p --platform)"{-p,--platform}'[Override the operating system]:platform:(( - common linux macos sunos diff --git a/docs/src/usage.txt b/docs/src/usage.txt index 56029b8c..5ab6fd98 100644 --- a/docs/src/usage.txt +++ b/docs/src/usage.txt @@ -11,8 +11,8 @@ ARGS: OPTIONS: -l, --list List all commands in the cache -f, --render Render a specific markdown file - -p, --platform Override the operating system [possible values: common, linux, - macos, windows, sunos, osx, android, freebsd, netbsd, openbsd] + -p, --platform Override the operating system [possible values: linux, macos, + windows, sunos, osx, android, freebsd, netbsd, openbsd] -L, --language Override the language -u, --update Update the local cache --no-auto-update If auto update is configured, disable it for this run diff --git a/src/cache.rs b/src/cache.rs index acf40262..f88f7ee0 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -213,7 +213,6 @@ impl Cache { /// Return the platform directory. fn get_platform_dir(platform: PlatformType) -> &'static str { match platform { - PlatformType::Common => "common", PlatformType::Linux => "linux", PlatformType::OsX => "osx", PlatformType::SunOs => "sunos", diff --git a/src/cli.rs b/src/cli.rs index 7fe8cdc9..3825245e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -40,7 +40,7 @@ pub(crate) struct Args { short = 'p', long = "platform", action = ArgAction::Append, - possible_values = ["common", "linux", "macos", "windows", "sunos", "osx", "android", "freebsd", "netbsd", "openbsd"], + possible_values = ["linux", "macos", "windows", "sunos", "osx", "android", "freebsd", "netbsd", "openbsd"], )] pub platforms: Option>, diff --git a/src/types.rs b/src/types.rs index fa1995d5..649741f3 100644 --- a/src/types.rs +++ b/src/types.rs @@ -9,7 +9,6 @@ use serde_derive::{Deserialize, Serialize}; #[serde(rename_all = "lowercase")] #[allow(dead_code)] pub enum PlatformType { - Common, Linux, OsX, SunOs, @@ -23,7 +22,6 @@ pub enum PlatformType { impl fmt::Display for PlatformType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Self::Common => write!(f, "Common"), Self::Linux => write!(f, "Linux"), Self::OsX => write!(f, "macOS / BSD"), Self::SunOs => write!(f, "SunOS"), @@ -41,7 +39,6 @@ impl str::FromStr for PlatformType { fn from_str(s: &str) -> Result { match s { - "common" => Ok(Self::Common), "linux" => Ok(Self::Linux), "osx" | "macos" => Ok(Self::OsX), "sunos" => Ok(Self::SunOs), @@ -51,7 +48,7 @@ impl str::FromStr for PlatformType { "netbsd" => Ok(Self::NetBSD), "openbsd" => Ok(Self::OpenBSD), other => Err(anyhow!( - "Unknown OS: {}. Possible values: common, linux, macos, osx, sunos, windows, android, freebsd, netbsd, openbsd", + "Unknown OS: {}. Possible values: linux, macos, osx, sunos, windows, android, freebsd, netbsd, openbsd", other )), } @@ -94,13 +91,7 @@ impl PlatformType { Self::OpenBSD } - #[cfg(any(target_os = "common",))] - pub fn current() -> Self { - Self::Common - } - #[cfg(not(any( - target_os = "common", target_os = "linux", target_os = "macos", target_os = "freebsd", From 14c92c28da888e00fa7c6cfeaa91c9f70b0384c5 Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Tue, 5 Mar 2024 05:19:37 +0530 Subject: [PATCH 5/8] revert: changes to CHANGELOG.md --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f2a5544..e26c4745 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Possible log types: - `[docs]` for documentation changes. - `[chore]` for maintenance work. + ### [v1.6.1][v1.6.1] (2022-10-24) Changes: @@ -27,6 +28,7 @@ Contributors to this version: Thanks! + ### [v1.6.0][v1.6.0] (2022-10-02) It's been 9 months since the last release already! This is not a huge update @@ -75,6 +77,7 @@ Contributors to this version: Thanks! + ### [v1.5.0][v1.5.0] (2021-12-31) This is quite a big release with many new features. In the 15 months since the @@ -162,6 +165,7 @@ Thanks! Last but not least, [Niklas Mohrin][@niklasmohrin] has joined the project as co-maintainer. Thank you for your help! + ### [v1.4.1][v1.4.1] (2020-09-04) - [fixed] Syntax error in zsh completion file ([#138][i138]) @@ -174,6 +178,7 @@ Contributors to this version: Thanks! + ### [v1.4.0][v1.4.0] (2020-09-03) - [added] Configurable automatic cache updates ([#115][i115]) @@ -195,6 +200,7 @@ Contributors to this version: Thanks! + ### [v1.3.0][v1.3.0] (2020-02-28) - [added] New config option for compact output mode ([#89][i89]) @@ -220,6 +226,7 @@ Contributors to this version: Thanks! + ### [v1.2.0][v1.2.0] (2019-08-10) - [added] Add Windows support ([#77][i77]) @@ -246,6 +253,7 @@ Contributors to this version: Thanks! + ### [v1.1.0][v1.1.0] (2018-10-22) - [added] Configuration file support ([#43][i43]) @@ -263,6 +271,7 @@ Contributors to this version: Thanks! + ### [v1.0.0][v1.0.0] (2018-02-11) - [added] Include bash completions ([#34][i34]) @@ -270,19 +279,23 @@ Thanks! - [changed] Require at least Rust 1.19 to build (previous: 1.9) - [changed] Improved unit/integration testing + ### v0.4.0 (2016-11-25) - [added] Support for new page format - [changed] Update all dependencies + ### v0.3.0 (2016-08-01) - [changed] Update curl dependency + ### v0.2.0 (2016-04-16) - First crates.io release + [@0ndorio]: https://github.com/0ndorio [@aldanor]: https://github.com/aldanor [@Atul9]: https://github.com/Atul9 From f2330bd1d25e582694b90d4b2ac7ffbd857e369c Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Tue, 5 Mar 2024 05:20:12 +0530 Subject: [PATCH 6/8] cleanup: remove cargo updates from dependabot --- .github/dependabot.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c0e00fb2..8ac6b8c4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,9 +1,5 @@ version: 2 updates: - - package-ecosystem: "cargo" - directory: "/" - schedule: - interval: "monthly" - package-ecosystem: "github-actions" directory: "/" schedule: From d7d97c1f164d77fc3daa107e94eb49a77491e8cc Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Wed, 10 Apr 2024 19:21:16 +0530 Subject: [PATCH 7/8] types.rs: update file Signed-off-by: K.B.Dharun Krishna --- src/types.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/types.rs b/src/types.rs index 649741f3..01193d05 100644 --- a/src/types.rs +++ b/src/types.rs @@ -14,9 +14,9 @@ pub enum PlatformType { SunOs, Windows, Android, - FreeBSD, - NetBSD, - OpenBSD, + FreeBsd, + NetBsd, + OpenBsd, } impl fmt::Display for PlatformType { @@ -76,17 +76,17 @@ impl PlatformType { Self::Android } - #[cfg(any(target_os = "freebsd",))] + #[cfg(any(target_os = "freebsd"))] pub fn current() -> Self { Self::FreeBSD } - #[cfg(any(target_os = "netbsd",))] + #[cfg(any(target_os = "netbsd"))] pub fn current() -> Self { Self::NetBSD } - #[cfg(any(target_os = "openbsd",))] + #[cfg(any(target_os = "openbsd"))] pub fn current() -> Self { Self::OpenBSD } From fdca13207dffdd3319077235c0054fb7f5abd7ce Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Wed, 10 Apr 2024 19:25:16 +0530 Subject: [PATCH 8/8] fix: update Bsd case convention Signed-off-by: K.B.Dharun Krishna --- src/cache.rs | 6 +++--- src/types.rs | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cache.rs b/src/cache.rs index f88f7ee0..8fccb628 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -218,9 +218,9 @@ impl Cache { PlatformType::SunOs => "sunos", PlatformType::Windows => "windows", PlatformType::Android => "android", - PlatformType::FreeBSD => "freebsd", - PlatformType::NetBSD => "netbsd", - PlatformType::OpenBSD => "openbsd", + PlatformType::FreeBsd => "freebsd", + PlatformType::NetBsd => "netbsd", + PlatformType::OpenBsd => "openbsd", } } diff --git a/src/types.rs b/src/types.rs index 01193d05..2de2d2bd 100644 --- a/src/types.rs +++ b/src/types.rs @@ -27,9 +27,9 @@ impl fmt::Display for PlatformType { Self::SunOs => write!(f, "SunOS"), Self::Windows => write!(f, "Windows"), Self::Android => write!(f, "Android"), - Self::FreeBSD => write!(f, "FreeBSD"), - Self::NetBSD => write!(f, "NetBSD"), - Self::OpenBSD => write!(f, "OpenBSD"), + Self::FreeBsd => write!(f, "FreeBSD"), + Self::NetBsd => write!(f, "NetBSD"), + Self::OpenBsd => write!(f, "OpenBSD"), } } } @@ -44,9 +44,9 @@ impl str::FromStr for PlatformType { "sunos" => Ok(Self::SunOs), "windows" => Ok(Self::Windows), "android" => Ok(Self::Android), - "freebsd" => Ok(Self::FreeBSD), - "netbsd" => Ok(Self::NetBSD), - "openbsd" => Ok(Self::OpenBSD), + "freebsd" => Ok(Self::FreeBsd), + "netbsd" => Ok(Self::NetBsd), + "openbsd" => Ok(Self::OpenBsd), other => Err(anyhow!( "Unknown OS: {}. Possible values: linux, macos, osx, sunos, windows, android, freebsd, netbsd, openbsd", other @@ -78,17 +78,17 @@ impl PlatformType { #[cfg(any(target_os = "freebsd"))] pub fn current() -> Self { - Self::FreeBSD + Self::FreeBsd } #[cfg(any(target_os = "netbsd"))] pub fn current() -> Self { - Self::NetBSD + Self::NetBsd } #[cfg(any(target_os = "openbsd"))] pub fn current() -> Self { - Self::OpenBSD + Self::OpenBsd } #[cfg(not(any(