Skip to content

Commit

Permalink
Add --explicit flag for list installed
Browse files Browse the repository at this point in the history
  • Loading branch information
tarkah committed Feb 17, 2024
1 parent 52a7835 commit 27f582b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/moss/src/cli/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ pub fn command() -> Command {
.subcommand(
Command::new("installed")
.about("List all installed packages")
.visible_alias("li"),
.visible_alias("li")
.arg(arg!(-e --"explicit" "List explicit packages only")),
)
.subcommand(
Command::new("available")
Expand All @@ -50,7 +51,14 @@ pub async fn handle(args: &ArgMatches) -> Result<(), Error> {

let (filter_flags, sync) = match args.subcommand() {
Some(("available", _)) => (Flags::AVAILABLE, None),
Some(("installed", _)) => (Flags::INSTALLED, None),
Some(("installed", args)) => {
let flags = if *args.get_one::<bool>("explicit").unwrap() {
Flags::INSTALLED | Flags::EXPLICIT
} else {
Flags::INSTALLED
};
(flags, None)
}
Some(("sync", args)) => {
let sync = if *args.get_one::<bool>("upgrade-only").unwrap() {
Sync::Upgrades
Expand Down

0 comments on commit 27f582b

Please sign in to comment.