diff options
author | Rasmus Steinke <rasi@xssn.at> | 2017-08-05 21:29:04 +0200 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2017-08-05 21:29:04 +0200 |
commit | 6582e82885d50499dd63ce735d1927da038560d7 (patch) | |
tree | aa653bcb082547b862138cf8c88c70fc9c0a4f01 /clerk | |
parent | 2b9ea774c6eb1e3ffdbfc99f555dc45dd1023c54 (diff) | |
download | perl-app-clerk-6582e82885d50499dd63ce735d1927da038560d7.tar.gz perl-app-clerk-6582e82885d50499dd63ce735d1927da038560d7.tar.xz |
automatically run rofi on cli arguments
Diffstat (limited to 'clerk')
-rwxr-xr-x | clerk | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -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"); - } } |