1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-12 06:07:56 +00:00
starship/src/modules/mod.rs

269 lines
11 KiB
Rust
Raw Normal View History

// While adding out new module add out module to src/module.rs ALL_MODULES const array also.
mod aws;
mod azure;
mod buf;
2019-04-05 01:35:24 +00:00
mod character;
mod cmake;
mod cmd_duration;
mod cobol;
2019-10-05 18:25:25 +00:00
mod conda;
mod container;
mod crystal;
2020-04-11 16:37:24 +00:00
pub(crate) mod custom;
2020-07-29 15:38:23 +00:00
mod dart;
mod deno;
2019-04-05 00:35:35 +00:00
mod directory;
mod docker_context;
mod dotnet;
2020-03-02 03:29:27 +00:00
mod elixir;
mod elm;
mod env_var;
mod erlang;
mod fill;
mod gcloud;
mod git_branch;
2019-12-06 16:57:42 +00:00
mod git_commit;
mod git_metrics;
mod git_state;
2019-05-14 04:43:11 +00:00
mod git_status;
mod golang;
mod helm;
2019-12-02 22:37:18 +00:00
mod hg_branch;
mod hostname;
mod java;
mod jobs;
mod julia;
mod kotlin;
mod kubernetes;
2019-04-05 00:35:35 +00:00
mod line_break;
mod localip;
mod lua;
mod memory_usage;
mod nim;
2019-08-25 15:41:20 +00:00
mod nix_shell;
2019-04-10 13:22:11 +00:00
mod nodejs;
mod ocaml;
mod openstack;
2019-05-01 14:45:56 +00:00
mod package;
mod perl;
2019-12-05 18:04:27 +00:00
mod php;
2021-10-05 23:27:25 +00:00
mod pulumi;
mod purescript;
2019-04-25 15:06:18 +00:00
mod python;
mod red;
feat(r-lang): add module for R programming language (#1475) * feat(formatter): Allow scoped variables (#1094) * feat: Allow scoped variables , with the following improvements to the format string parser. - Add documentation to spec - Simplify some syntax in the spec - Rewrite for loop with iterators * Added support for R programming language. * Removed unnecessary debug log used during dev process. * Make the `R` command upper case as the *nix OS executables are case sensitives and the correct command is upper-case. * Changed comments to reflect R features (rather than node.js where code was coming from). * feat(format_string): Allow positional segments (#1138) * feat(format_string): Allow using variables in a style string (#1130) * fix(format_string): Allow multiple variable mappers (#1142) * refactor: Add error handling to variables (#1148) * Squashed commit of changes with meta variables: commit 5beb3bca18f0b0c822b740afb3778ccb1e3a7d19 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Mon Apr 27 09:52:59 2020 +0800 fix: Cache variables in meta variables properly commit 49b9324942dd55350c87107d0e8c7d1592d92e8a Merge: cc575bc 260a1ab Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sun Apr 26 21:34:52 2020 +0800 Merge branch 'feat/format-string' into meta-variables commit cc575bc27cbf87c4197e96d2fa5416d4932e45d7 Merge: 3ed2d32 e0c1901 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sun Apr 26 12:16:12 2020 +0800 Merge branch 'feat/format-string' into meta-variables commit 3ed2d326c9f625930bdd72cea736c1d0eab6d381 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sun Apr 26 11:06:28 2020 +0800 refactor(format_string): Allow returning error in variable mapper commit 766732fe697df947538fe12ca92a8eb8e7bfea3e Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:56:02 2020 +0800 fix: Add test for StyleVariableHolder commit 444334ad206a68132fa6257b83c3992b7b790981 Merge: 479d4a7 9796a66 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:52:27 2020 +0800 Merge branch 'positional-segments' into style-variables commit 9796a66a9679597676e7fd859197fd542e8042dc Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:51:26 2020 +0800 test: Add tests for VariableHolder commit 479d4a72fa58fd8aa777acd8228d4834407a7b6a Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:41:47 2020 +0800 feat: Add trait StyleVariableHolder commit 21d40c6f4e2d12b34fdec4e2e38b6ad0f91217a3 Merge: 3b459f4 e7dd987 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:17:11 2020 +0800 Merge branch 'positional-segments' into style-variables commit e7dd987fd7b01a82c6012ba7055d1dd9b5fd84aa Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 15:10:12 2020 +0800 misc: Minor changes on docs and codes commit 71020b0397a86e850ad5beda926aa9416250025c Author: heyrict <xiezh0831@yahoo.co.jp> Date: Fri Apr 24 20:51:45 2020 +0800 feat(format_string): Add syntax for positional segments commit 3b459f4379b08defce50c57a903502513ad1b2b6 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Wed Apr 22 17:49:15 2020 +0800 fix: Fix clippy commit 2fb052d68cb46680c081f5a0e25e2c3fbdc9e204 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Wed Apr 22 17:02:09 2020 +0800 feat: Add map_style method to feed values in style string * fix: Change error type of StringFormatter::new * fix: Fix rustfmt * tests: Add tests to variable errors * docs: Add documentation * chore: Rename positional to conditional (#1166) * docs: Add docs for format strings (#1083) Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com> * refactor(rust): Use format strings (#1063) * Updated to latest string formatter's changes. * feat(format-string): add format string support to battery module (#1158) * update battery module with format string * update battery module docs * update battery module with format string * update battery module docs * fix battery module with new StringFormatter api * fix clippy warnings * Update docs/config/README.md Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp> * battery symbols now supports format-string * battery symbols now support format-string remove space between symbol and percentage fix battery config Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp> * refactor(golang): Use format strings (#1066) * refactor(golang): Use format strings * docs(golang): Update docs * docs(golang): Update docs * fix: Update to upstream API changes * docs(golang): Update docs Co-authored-by: heyrict <xiezh0831@yahoo.co.jp> * Fixed a few inconsistencies. * Removed string clone in favor of a reference. * Update src/modules/r.rs Reverting the r version string formatting to a more idiomatic way of handling it. Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com> * Update src/configs/r.rs Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp> * Updated documentation to reflect changes in config. * refactor(java): Added formatter support for Java module. (#1084) * refactor(haskell): Added formatter support for the Haskell module. (#1111) * Added formatter support for the Haskell module. * Updated haskell module with latest formatter code changes. * Changed documentation for latest Haskell string formatter changes. * Fixed a few inconsistencies. * Removed unnecessary variable cloning for using reference instead. * refactor(env_var): Added formatter support for the env_var module (#1180) * refactor(memory_usage): Added formatter support for memory_usage module (#1182) * Migrated the memory usage module to string formatter' support. * Fixed a few inconsistencies. * Removed cloning of variables to instead use references. * refactor(cmd_duration): Use format strings (#1200) * Fixed format issue in code. * Fixed compilation error after adding new 'r' module in root config. * Added .Rproj extension file to be detected with R prog lang. * Aligned R module code with existing ones. * Update src/configs/r.rs Co-authored-by: David Knaack <davidkna@users.noreply.github.com> * fix: Added rconfig to fullconfig and fixed broken api calls * Apply suggestions from code review Co-authored-by: Dario Vladović <d.vladimyr@gmail.com> * Update src/modules/r.rs Co-authored-by: Dario Vladović <d.vladimyr@gmail.com> * Addressed PR comments. Cleaned up code and fixed code errors. * Updated docs for consistency purpose. Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com> * refactor: Renamed the `r` module to `rlang` * test: Provided R fixture and R module renderer test * doc: Updated rlang mod config to reflect latest detection changes * fix: Added missing rlang entry in config/mod * feat: Added version formatted fined grained configuration * Added version_format in R lang documentation. Co-authored-by: David Knaack <davidkna@users.noreply.github.com> * review: Addressed later comments * fix: README was missing a previously present section for Python * Fix: Test was not updated for previous version string upgrade. * fix: Upgraded R version in remaining test. Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp> Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com> Co-authored-by: Luca Rinaldi <lucarin@protonmail.com> Co-authored-by: John Letey <johnletey@gmail.com> Co-authored-by: Tilmann Meyer <47182955+ATiltedTree@users.noreply.github.com> Co-authored-by: David Knaack <davidkna@users.noreply.github.com> Co-authored-by: Dario Vladović <d.vladimyr@gmail.com> Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
2021-05-25 18:13:30 +00:00
mod rlang;
2019-08-13 22:43:29 +00:00
mod ruby;
2019-04-21 23:37:34 +00:00
mod rust;
mod scala;
mod shell;
mod shlvl;
2020-02-26 16:18:19 +00:00
mod singularity;
mod status;
mod sudo;
2020-07-29 15:36:49 +00:00
mod swift;
mod terraform;
mod time;
mod username;
mod utils;
mod vagrant;
mod vcsh;
mod vlang;
2020-05-21 16:49:49 +00:00
mod zig;
2019-04-04 00:14:26 +00:00
#[cfg(feature = "battery")]
mod battery;
#[cfg(feature = "battery")]
pub use self::battery::{BatteryInfoProvider, BatteryInfoProviderImpl};
use crate::config::RootModuleConfig;
use crate::context::{Context, Shell};
2019-05-01 20:34:24 +00:00
use crate::module::Module;
use std::time::Instant;
2019-04-04 16:18:02 +00:00
pub fn handle<'a>(module: &str, context: &'a Context) -> Option<Module<'a>> {
let start: Instant = Instant::now();
let mut m: Option<Module> = {
match module {
// Keep these ordered alphabetically.
// Default ordering is handled in configs/starship_root.rs
"aws" => aws::module(context),
"azure" => azure::module(context),
#[cfg(feature = "battery")]
"battery" => battery::module(context),
"buf" => buf::module(context),
"character" => character::module(context),
"cmake" => cmake::module(context),
"cmd_duration" => cmd_duration::module(context),
"cobol" => cobol::module(context),
"conda" => conda::module(context),
"container" => container::module(context),
"dart" => dart::module(context),
"deno" => deno::module(context),
"directory" => directory::module(context),
"docker_context" => docker_context::module(context),
"dotnet" => dotnet::module(context),
"elixir" => elixir::module(context),
"elm" => elm::module(context),
"erlang" => erlang::module(context),
"env_var" => env_var::module(context),
"fill" => fill::module(context),
"gcloud" => gcloud::module(context),
"git_branch" => git_branch::module(context),
"git_commit" => git_commit::module(context),
"git_metrics" => git_metrics::module(context),
"git_state" => git_state::module(context),
"git_status" => git_status::module(context),
"golang" => golang::module(context),
"helm" => helm::module(context),
"hg_branch" => hg_branch::module(context),
"hostname" => hostname::module(context),
"java" => java::module(context),
"jobs" => jobs::module(context),
"julia" => julia::module(context),
"kotlin" => kotlin::module(context),
"kubernetes" => kubernetes::module(context),
"line_break" => line_break::module(context),
"localip" => localip::module(context),
"lua" => lua::module(context),
"memory_usage" => memory_usage::module(context),
"nim" => nim::module(context),
"nix_shell" => nix_shell::module(context),
"nodejs" => nodejs::module(context),
"ocaml" => ocaml::module(context),
"openstack" => openstack::module(context),
"package" => package::module(context),
"perl" => perl::module(context),
"php" => php::module(context),
2021-10-05 23:27:25 +00:00
"pulumi" => pulumi::module(context),
"purescript" => purescript::module(context),
"python" => python::module(context),
feat(r-lang): add module for R programming language (#1475) * feat(formatter): Allow scoped variables (#1094) * feat: Allow scoped variables , with the following improvements to the format string parser. - Add documentation to spec - Simplify some syntax in the spec - Rewrite for loop with iterators * Added support for R programming language. * Removed unnecessary debug log used during dev process. * Make the `R` command upper case as the *nix OS executables are case sensitives and the correct command is upper-case. * Changed comments to reflect R features (rather than node.js where code was coming from). * feat(format_string): Allow positional segments (#1138) * feat(format_string): Allow using variables in a style string (#1130) * fix(format_string): Allow multiple variable mappers (#1142) * refactor: Add error handling to variables (#1148) * Squashed commit of changes with meta variables: commit 5beb3bca18f0b0c822b740afb3778ccb1e3a7d19 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Mon Apr 27 09:52:59 2020 +0800 fix: Cache variables in meta variables properly commit 49b9324942dd55350c87107d0e8c7d1592d92e8a Merge: cc575bc 260a1ab Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sun Apr 26 21:34:52 2020 +0800 Merge branch 'feat/format-string' into meta-variables commit cc575bc27cbf87c4197e96d2fa5416d4932e45d7 Merge: 3ed2d32 e0c1901 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sun Apr 26 12:16:12 2020 +0800 Merge branch 'feat/format-string' into meta-variables commit 3ed2d326c9f625930bdd72cea736c1d0eab6d381 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sun Apr 26 11:06:28 2020 +0800 refactor(format_string): Allow returning error in variable mapper commit 766732fe697df947538fe12ca92a8eb8e7bfea3e Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:56:02 2020 +0800 fix: Add test for StyleVariableHolder commit 444334ad206a68132fa6257b83c3992b7b790981 Merge: 479d4a7 9796a66 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:52:27 2020 +0800 Merge branch 'positional-segments' into style-variables commit 9796a66a9679597676e7fd859197fd542e8042dc Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:51:26 2020 +0800 test: Add tests for VariableHolder commit 479d4a72fa58fd8aa777acd8228d4834407a7b6a Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:41:47 2020 +0800 feat: Add trait StyleVariableHolder commit 21d40c6f4e2d12b34fdec4e2e38b6ad0f91217a3 Merge: 3b459f4 e7dd987 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 22:17:11 2020 +0800 Merge branch 'positional-segments' into style-variables commit e7dd987fd7b01a82c6012ba7055d1dd9b5fd84aa Author: heyrict <xiezh0831@yahoo.co.jp> Date: Sat Apr 25 15:10:12 2020 +0800 misc: Minor changes on docs and codes commit 71020b0397a86e850ad5beda926aa9416250025c Author: heyrict <xiezh0831@yahoo.co.jp> Date: Fri Apr 24 20:51:45 2020 +0800 feat(format_string): Add syntax for positional segments commit 3b459f4379b08defce50c57a903502513ad1b2b6 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Wed Apr 22 17:49:15 2020 +0800 fix: Fix clippy commit 2fb052d68cb46680c081f5a0e25e2c3fbdc9e204 Author: heyrict <xiezh0831@yahoo.co.jp> Date: Wed Apr 22 17:02:09 2020 +0800 feat: Add map_style method to feed values in style string * fix: Change error type of StringFormatter::new * fix: Fix rustfmt * tests: Add tests to variable errors * docs: Add documentation * chore: Rename positional to conditional (#1166) * docs: Add docs for format strings (#1083) Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com> * refactor(rust): Use format strings (#1063) * Updated to latest string formatter's changes. * feat(format-string): add format string support to battery module (#1158) * update battery module with format string * update battery module docs * update battery module with format string * update battery module docs * fix battery module with new StringFormatter api * fix clippy warnings * Update docs/config/README.md Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp> * battery symbols now supports format-string * battery symbols now support format-string remove space between symbol and percentage fix battery config Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp> * refactor(golang): Use format strings (#1066) * refactor(golang): Use format strings * docs(golang): Update docs * docs(golang): Update docs * fix: Update to upstream API changes * docs(golang): Update docs Co-authored-by: heyrict <xiezh0831@yahoo.co.jp> * Fixed a few inconsistencies. * Removed string clone in favor of a reference. * Update src/modules/r.rs Reverting the r version string formatting to a more idiomatic way of handling it. Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com> * Update src/configs/r.rs Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp> * Updated documentation to reflect changes in config. * refactor(java): Added formatter support for Java module. (#1084) * refactor(haskell): Added formatter support for the Haskell module. (#1111) * Added formatter support for the Haskell module. * Updated haskell module with latest formatter code changes. * Changed documentation for latest Haskell string formatter changes. * Fixed a few inconsistencies. * Removed unnecessary variable cloning for using reference instead. * refactor(env_var): Added formatter support for the env_var module (#1180) * refactor(memory_usage): Added formatter support for memory_usage module (#1182) * Migrated the memory usage module to string formatter' support. * Fixed a few inconsistencies. * Removed cloning of variables to instead use references. * refactor(cmd_duration): Use format strings (#1200) * Fixed format issue in code. * Fixed compilation error after adding new 'r' module in root config. * Added .Rproj extension file to be detected with R prog lang. * Aligned R module code with existing ones. * Update src/configs/r.rs Co-authored-by: David Knaack <davidkna@users.noreply.github.com> * fix: Added rconfig to fullconfig and fixed broken api calls * Apply suggestions from code review Co-authored-by: Dario Vladović <d.vladimyr@gmail.com> * Update src/modules/r.rs Co-authored-by: Dario Vladović <d.vladimyr@gmail.com> * Addressed PR comments. Cleaned up code and fixed code errors. * Updated docs for consistency purpose. Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com> * refactor: Renamed the `r` module to `rlang` * test: Provided R fixture and R module renderer test * doc: Updated rlang mod config to reflect latest detection changes * fix: Added missing rlang entry in config/mod * feat: Added version formatted fined grained configuration * Added version_format in R lang documentation. Co-authored-by: David Knaack <davidkna@users.noreply.github.com> * review: Addressed later comments * fix: README was missing a previously present section for Python * Fix: Test was not updated for previous version string upgrade. * fix: Upgraded R version in remaining test. Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp> Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com> Co-authored-by: Luca Rinaldi <lucarin@protonmail.com> Co-authored-by: John Letey <johnletey@gmail.com> Co-authored-by: Tilmann Meyer <47182955+ATiltedTree@users.noreply.github.com> Co-authored-by: David Knaack <davidkna@users.noreply.github.com> Co-authored-by: Dario Vladović <d.vladimyr@gmail.com> Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
2021-05-25 18:13:30 +00:00
"rlang" => rlang::module(context),
"red" => red::module(context),
"ruby" => ruby::module(context),
"rust" => rust::module(context),
"scala" => scala::module(context),
"shell" => shell::module(context),
"shlvl" => shlvl::module(context),
"singularity" => singularity::module(context),
"swift" => swift::module(context),
"status" => status::module(context),
"sudo" => sudo::module(context),
"terraform" => terraform::module(context),
"time" => time::module(context),
"crystal" => crystal::module(context),
"username" => username::module(context),
"vlang" => vlang::module(context),
"vagrant" => vagrant::module(context),
"vcsh" => vcsh::module(context),
"zig" => zig::module(context),
_ => {
eprintln!("Error: Unknown module {}. Use starship module --list to list out all supported modules.", module);
None
}
}
};
let elapsed = start.elapsed();
log::trace!("Took {:?} to compute module {:?}", elapsed, module);
if elapsed.as_millis() >= 1 {
// If we take less than 1ms to compute a None, then we will not return a module at all
// if we have a module: default duration is 0 so no need to change it
// if we took more than 1ms we want to report that and so--in case we have None currently--
// need to create an empty module just to hold the duration for that case
m.get_or_insert_with(|| context.new_module(module)).duration = elapsed;
2019-04-04 00:14:26 +00:00
}
m
2019-04-04 00:14:26 +00:00
}
pub fn description(module: &str) -> &'static str {
match module {
"aws" => "The current AWS region and profile",
"azure" => "The current Azure subscription",
"battery" => "The current charge of the device's battery and its current charging status",
"buf" => "The currently installed version of the Buf CLI",
"character" => {
"A character (usually an arrow) beside where the text is entered in your terminal"
}
"cmake" => "The currently installed version of CMake",
"cmd_duration" => "How long the last command took to execute",
"cobol" => "The currently installed version of COBOL/GNUCOBOL",
"conda" => "The current conda environment, if $CONDA_DEFAULT_ENV is set",
"container" => "The container indicator, if inside a container.",
"crystal" => "The currently installed version of Crystal",
2020-07-29 15:38:23 +00:00
"dart" => "The currently installed version of Dart",
"deno" => "The currently installed version of Deno",
"directory" => "The current working directory",
"docker_context" => "The current docker context",
"dotnet" => "The relevant version of the .NET Core SDK for the current directory",
"elixir" => "The currently installed versions of Elixir and OTP",
"elm" => "The currently installed version of Elm",
"env_var" => "Displays the current value of a selected environment variable",
"erlang" => "Current OTP version",
"fill" => "Fills the remaining space on the line with a pad string",
"gcloud" => "The current GCP client configuration",
"git_branch" => "The active branch of the repo in your current directory",
"git_commit" => "The active commit (and tag if any) of the repo in your current directory",
"git_metrics" => "The currently added/deleted lines in your repo",
"git_state" => "The current git operation, and it's progress",
"git_status" => "Symbol representing the state of the repo",
"golang" => "The currently installed version of Golang",
"helm" => "The currently installed version of Helm",
"hg_branch" => "The active branch of the repo in your current directory",
"hostname" => "The system hostname",
"java" => "The currently installed version of Java",
"jobs" => "The current number of jobs running",
"julia" => "The currently installed version of Julia",
"kotlin" => "The currently installed version of Kotlin",
"kubernetes" => "The current Kubernetes context name and, if set, the namespace",
"line_break" => "Separates the prompt into two lines",
"localip" => "The currently assigned ipv4 address",
"lua" => "The currently installed version of Lua",
"memory_usage" => "Current system memory and swap usage",
"nim" => "The currently installed version of Nim",
"nix_shell" => "The nix-shell environment",
"nodejs" => "The currently installed version of NodeJS",
"ocaml" => "The currently installed version of OCaml",
"openstack" => "The current OpenStack cloud and project",
"package" => "The package version of the current directory's project",
"perl" => "The currently installed version of Perl",
"php" => "The currently installed version of PHP",
"pulumi" => "The current username, stack, and installed version of Pulumi",
"purescript" => "The currently installed version of PureScript",
"python" => "The currently installed version of Python",
"red" => "The currently installed version of Red",
"rlang" => "The currently installed version of R",
"ruby" => "The currently installed version of Ruby",
"rust" => "The currently installed version of Rust",
"scala" => "The currently installed version of Scala",
"shell" => "The currently used shell indicator",
"shlvl" => "The current value of SHLVL",
"singularity" => "The currently used Singularity image",
"status" => "The status of the last command",
"sudo" => "The sudo credentials are currently cached",
"swift" => "The currently installed version of Swift",
"terraform" => "The currently selected terraform workspace and version",
"time" => "The current local time",
"username" => "The active user's username",
"vagrant" => "The currently installed version of Vagrant",
"vcsh" => "The currently active VCSH repository",
"vlang" => "The currently installed version of V",
2020-05-21 16:49:49 +00:00
"zig" => "The currently installed version of Zig",
_ => "<no description>",
}
}
#[cfg(test)]
mod test {
use super::*;
use crate::module::ALL_MODULES;
#[test]
fn all_modules_have_description() {
for module in ALL_MODULES {
println!("Checking if {:?} has a description", module);
assert_ne!(description(module), "<no description>");
}
}
}