Skip to content

Commit a83efbe

Browse files
committed
feat: Add print subcommand
1 parent d423609 commit a83efbe

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

choose.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ main() {
4646
do_launch "$category" "$gui"
4747
;;
4848
print)
49+
local category="${argsCommands[1]}"
50+
51+
do_print "$category" "$gui"
4952
;;
5053
esac
5154
}

lib/do.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,15 @@ do_launch() {
8080
source "$dbDir/$category/post.sh"
8181
fi
8282
}
83+
84+
do_print() {
85+
local category="$1"
86+
87+
program="$(<"$dbDir/$category/_.current")"
88+
89+
# ensure variable (we already use 'ensure_has_dot_current' in
90+
# helper_get_category_filter; this is another safeguard)
91+
if [ -z "$program" ]; then
92+
log.die "$gui" "Program for '$category' is not set. Please set with 'choose set'"
93+
fi
94+
}

0 commit comments

Comments
 (0)