Skip to content

Commit

Permalink
Add an option to specify which shell 🐢 to fetch (default/current) (#124)
Browse files Browse the repository at this point in the history
* Bump libmacchina version to v0.7.8

* Add support for defining which shell to fetch (default/current)

* Fix one of the match conditions

* Update the flag name & mention it in config (current_shell)
  • Loading branch information
grtcdr authored Aug 13, 2021
1 parent 2a4b52d commit f7c14a3
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 101 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "README_CARGO.md"
build = "build.rs"

[dependencies]
libmacchina = "0.7.7"
libmacchina = "0.7.8"
bytesize = "1.0.1"
clap = "2.33.3"
tui = { version = "0.15.0", default-features = false, features = ['crossterm'] }
Expand All @@ -29,7 +29,7 @@ serde_json = "1.0.64"
google_speech = { version = "0.1.0" , optional = true }

[build-dependencies]
libmacchina = "0.7.7"
libmacchina = "0.7.8"
bytesize = "1.0.1"
clap = "2.33.3"
tui = { version = "0.15.0", default-features = false, features = ['crossterm'] }
Expand Down
59 changes: 27 additions & 32 deletions macchina.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,37 @@
# Disables color.
# Conflicts with: color, separator_color
no_color = false
no_color = false

# Hides the separator.
# Conflicts with: separator_color
no_separator = false
no_separator = false

# Hides bar delimiters
no_bar_delimiter = true
no_bar_delimiter = true

# Hides the title of the box surrounding system information
# Conflicts with: box_title
no_title = false
no_title = false

# Disables the box surrounding system information.
# Conflicts with: box_title
no_box = false
no_box = false

# Disables ASCII art
no_ascii = false
no_ascii = false

# Displays a palette of your active colorscheme
palette = true
palette = true

# Turns data into bars for specific readouts
# Turns data into bars for specific readouts
bar = true

# Prefer small ASCII variant.
# Conflicts with: no_ascii
small_ascii = false
small_ascii = false

# Randomizes the color of the keys each time your run the program
# Randomizes the color of the keys each time your run the program
random_color = false

# Randomizes the color of the separator each time your run the program
# Randomizes the color of the separator each time your run the program
random_sep_color = false

# Specify a color for the keys.
# Conflicts with: no_color
# Accepted values (case-sensitive):
# - White
# - Black
Expand All @@ -50,7 +44,6 @@ random_sep_color = false
color = "Blue"

# Specify a color for the separator.
# Conflicts with: no_color
# Accepted values (case-sensitive):
# - White
# - Black
Expand All @@ -63,21 +56,21 @@ color = "Blue"
separator_color = "Blue"

# Shorten uptime format
short_uptime = true
short_uptime = true

# Lengthen shell output
long_shell = false
long_shell = false

# Toggle between the current shell or the default one
current_shell = no

# Specify the title of the box
# Conflicts with: no_title.
box_title = " Macchina "

# Specify the horizontal inner margin value of the box surrounding system information.
# Conflicts with: no_box
box_inner_margin_x = 1

# Specify the vertical inner margin value of the box surrounding system information.
# Conflicts with: no_box
box_inner_margin_y = 0

# Specify the theme to use
Expand All @@ -90,8 +83,8 @@ box_inner_margin_y = 0
#
# Custom themes are also supported, they should be placed
# in $XDG_DATA_HOME/macchina/themes and must be a JSON file.
#
# To set 'foobar' as a theme, place foobar.json
#
# To set 'foobar' as a theme, place foobar.json
# in $XDG_DATA_HOME/macchina/themes
# and set theme = "foobar" (case-sensitive)
theme = "Beryllium"
Expand All @@ -100,7 +93,7 @@ theme = "Beryllium"
# Conflicts with: show_only
# Accepted values (case-sensitive):
# - Host
# - Machine
# - Machine
# - Kernel
# - Distribution
# - OperatingSystem
Expand All @@ -111,19 +104,20 @@ theme = "Beryllium"
# - Terminal
# - Shell
# - Uptime
# - Processor
# - ProcessorUsage
# - CPU
# - GPU
# - CPULoad
# - Memory
# - Battery
# Example:
# hide = ["Battery", "Memory", ...]
hide = []

# Displays only the specified readouts.
# Conflicts with: hide
# Conflicts with: hide
# Accepted values (case-sensitive):
# - Host
# - Machine
# - Machine
# - Kernel
# - Distribution
# - OperatingSystem
Expand All @@ -134,8 +128,9 @@ hide = []
# - Terminal
# - Shell
# - Uptime
# - Processor
# - ProcessorUsage
# - CPU
# - GPU
# - CPULoad
# - Memory
# - Battery
# Example:
Expand Down
25 changes: 14 additions & 11 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ pub struct Opt {
#[structopt(short = "S", long = "long-shell", help = "Lengthens shell output")]
pub long_shell: bool,

#[structopt(
short = "W",
long = "current-shell",
help = "Toggles between the current shell or the default one"
)]
pub current_shell: bool,

#[structopt(
short = "t",
long = "theme",
Expand Down Expand Up @@ -221,6 +228,7 @@ pub struct Opt {
default_value = "0"
)]
pub box_inner_margin_y: u16,

#[structopt(
long = "export-config",
help = "Prints the config file to stdout",
Expand Down Expand Up @@ -260,28 +268,23 @@ impl Default for Opt {
no_box: false,

color: None,
bar: false,

separator_color: None,
random_color: false,
random_sep_color: false,

custom_ascii: None,
custom_ascii_color: None,
small_ascii: false,

bar: false,
hide: None,
show_only: None,

doctor: false,

short_uptime: false,
long_shell: false,

current_shell: false,
theme: None,

box_title: None,

custom_ascii: None,
custom_ascii_color: None,
small_ascii: false,

box_inner_margin_x: 1,
box_inner_margin_y: 0,
export_config: false,
Expand Down
16 changes: 0 additions & 16 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,6 @@ impl Opt {
conflicts.push("hide and show_only");
}

if self.separator_color.is_some() && self.no_separator {
conflicts.push("separator_color and no_separator");
}

if self.color.is_some() && self.no_color {
conflicts.push("color and no_color");
}

if self.separator_color.is_some() && self.no_color {
conflicts.push("separator_color and no_color");
}

if self.box_title.is_some() && self.no_title {
conflicts.push("box_title and no_title");
}

conflicts
}
}
Loading

0 comments on commit f7c14a3

Please sign in to comment.