summaryrefslogtreecommitdiffstats
path: root/clerk
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2017-08-05 21:29:04 +0200
committerRasmus Steinke <rasi@xssn.at>2017-08-05 21:29:04 +0200
commit6582e82885d50499dd63ce735d1927da038560d7 (patch)
treeaa653bcb082547b862138cf8c88c70fc9c0a4f01 /clerk
parent2b9ea774c6eb1e3ffdbfc99f555dc45dd1023c54 (diff)
downloadperl-app-clerk-6582e82885d50499dd63ce735d1927da038560d7.tar.gz
perl-app-clerk-6582e82885d50499dd63ce735d1927da038560d7.tar.xz
automatically run rofi on cli arguments
Diffstat (limited to 'clerk')
-rwxr-xr-xclerk26
1 files changed, 14 insertions, 12 deletions
diff --git a/clerk b/clerk
index 9d4888a..b9b4a27 100755
--- a/clerk
+++ b/clerk
@@ -56,6 +56,20 @@ my $mpd = Net::MPD->connect($ENV{MPD_HOST} // $mpd_host // 'localhost');
sub main {
create_db();
+ my %options=();
+ getopts("talp", \%options);
+
+ $backend = 'rofi' if scalar %options;
+ if (defined $options{t}) {
+ list_db_entries_for("Tracks");
+ } elsif (defined $options{a}) {
+ list_db_entries_for("Albums");
+ } elsif (defined $options{p}) {
+ list_playlists();
+ } elsif (defined $options{l}) {
+ my $backend="rofi";
+ list_db_entries_for("Latest");
+ }
if ($backend eq "fzf") {
system('tmux', 'has-session', '-t', 'music');
if ($? != -0) {
@@ -68,18 +82,6 @@ sub main {
system('tmux', 'attach', '-t', 'music');
}
# elsif ($backend eq "rofi") {
- my %options=();
- getopts("talp", \%options);
-
- if (defined $options{t}) {
- list_db_entries_for("Tracks");
- } elsif (defined $options{a}) {
- list_db_entries_for("Albums");
- } elsif (defined $options{p}) {
- list_playlists();
- } elsif (defined $options{l}) {
- list_db_entries_for("Latest");
- }
}