diff options
author | Saurav Sharma <appdroiddeveloper@gmail.com> | 2019-08-20 10:27:25 +0545 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-08-20 00:42:25 -0400 |
commit | 075a76897cc28a6775c42b1d01a9c344c0f75ef0 (patch) | |
tree | 4f348709752d552694bda25e7f599359933be397 /src/modules | |
parent | 0e82c19f37e80e258ad7f0e6136a2bcf37c9648a (diff) |
fix: Change panicking on unknown module to error print and support module listing flag (#197)
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/modules/mod.rs b/src/modules/mod.rs index 3ab7d8b3f..4aa67108e 100644 --- a/src/modules/mod.rs +++ b/src/modules/mod.rs @@ -1,3 +1,4 @@ +// While adding out new module add out module to src/module.rs ALL_MODULES const array also. mod battery; mod character; mod cmd_duration; @@ -35,6 +36,9 @@ pub fn handle<'a>(module: &str, context: &'a Context) -> Option<Module<'a>> { "cmd_duration" => cmd_duration::module(context), "jobs" => jobs::module(context), - _ => panic!("Unknown module: {}", module), + _ => { + eprintln!("Error: Unknown module {}. Use starship module --list to list out all supported modules.", module); + None + } } } |