Skip to content
Snippets Groups Projects
Commit 3cecb009 authored by Nicolas80's avatar Nicolas80
Browse files

gcli command auto completion and arm64 build

- Added detailed instructions for generating the completion script and registering it for your shell when calling `gcli completion --help`
- Added that information in the CHANGELOG.md
- Moved `indoc` crate dependency in Cargo.toml to make it explicit it's now also used outside of tests.
parent bc740162
No related branches found
No related tags found
1 merge request!47gcli command auto completion and arm64 build
Pipeline #40608 passed
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
List of changelogs ordered from latest to oldest List of changelogs ordered from latest to oldest
## [0.4.2] - 2025-05-12 ## [0.4.2] - 2025-05-16
### Added / Changed ### Added / Changed
- Extra command `completion` added which takes a `--shell` argument to generate a completions script for a specified shell. - Extra command `completion` added which takes a `--shell` argument to generate a completions script for a specified shell.
- Calling this command with `gcli completion --help` will provide detailed instructions to generate the completion script and register it for your shell (not necessary when using the `.deb` package that include and registers the completion scripts for `bash`, `zsh` and `fish`)
### CI/CD ### CI/CD
- Adapted the Linux (amd64) build to: - Adapted the Linux (amd64) build to:
......
...@@ -46,6 +46,7 @@ bs58 = "^0.5.1" ...@@ -46,6 +46,7 @@ bs58 = "^0.5.1"
directories = "^5.0.1" directories = "^5.0.1"
comfy-table = "^7.1.1" comfy-table = "^7.1.1"
sea-orm = { version = "1.1.0", features = [ "sqlx-sqlite", "runtime-tokio-native-tls", "macros" ] } sea-orm = { version = "1.1.0", features = [ "sqlx-sqlite", "runtime-tokio-native-tls", "macros" ] }
indoc = "2.0.5"
# crypto # crypto
scrypt = { version = "^0.11", default-features = false } # for old-style key generation scrypt = { version = "^0.11", default-features = false } # for old-style key generation
...@@ -56,7 +57,6 @@ colored = "2.1.0" ...@@ -56,7 +57,6 @@ colored = "2.1.0"
# Tests # Tests
rstest = "0.23.0" rstest = "0.23.0"
indoc = "2.0.5"
# allows to build gcli for different runtimes and with different predefined networks # allows to build gcli for different runtimes and with different predefined networks
[features] [features]
......
...@@ -18,6 +18,7 @@ use codec::Encode; ...@@ -18,6 +18,7 @@ use codec::Encode;
use colored::Colorize; use colored::Colorize;
use data::*; use data::*;
use display::DisplayEvent; use display::DisplayEvent;
use indoc::indoc;
use keys::*; use keys::*;
use runtime_config::*; use runtime_config::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
...@@ -160,7 +161,32 @@ pub enum Subcommand { ...@@ -160,7 +161,32 @@ pub enum Subcommand {
/// Publish a new git tag with actual version /// Publish a new git tag with actual version
#[clap(hide = true)] #[clap(hide = true)]
Publish, Publish,
/// Generate a completions script for a specified shell /// Generate a completions script for a specified shell (use `completion --help` for more info)
#[clap(long_about = indoc! {r#"Generate a completions script for a specified shell.
The base completion scripts for `bash`, `zsh` or `fish` are already registered when installing the `.deb` package.
If you did not/could not install the `.deb` package we can generate the script and then configure the shell to use it.
Example for `bash`:
mkdir -p ~/.local/share/gcli
gcli completion --shell bash > ~/.local/share/gcli/completion.bash
# Direct test - gcli should have the completion after the source command
source ~/.local/share/gcli/completion.bash
# Persisting the configuration in the shell configuration file, add this at the end of your `~/.bashrc` file
[[ -f $HOME/.local/share/gcli/completion.bash ]] && source $HOME/.local/share/gcli/completion.bash
# Might need to reopen the shell for the configuration to be applied
Example for `zsh`:
mkdir -p ~/.local/share/gcli
gcli completion --shell zsh > ~/.local/share/gcli/completion.zsh
# Direct test - gcli should have the completion after the source command
source ~/.local/share/gcli/completion.zsh
# Persisting the configuration in the shell configuration file, add this at the end of your `~/.zshrc` file
[[ -f $HOME/.local/share/gcli/completion.zsh ]] && source $HOME/.local/share/gcli/completion.zsh
# Might need to reopen the shell for the configuration to be applied
"#})]
Completion { Completion {
/// target shell /// target shell
#[clap(long)] #[clap(long)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment