diff options
author | Guillermo Ramos | 2022-01-12 15:43:39 +0100 |
---|---|---|
committer | Guillermo Ramos | 2022-01-12 15:43:39 +0100 |
commit | 0a584017ff7a375f250cd8e38aeedd19b3905f5e (patch) | |
tree | 4ca8e98e6c81695fdba2e33f860939e7df389f01 | |
parent | e649822b6ae91793a79e2167483390e154acf331 (diff) | |
download | cli-0a584017ff7a375f250cd8e38aeedd19b3905f5e.tar.gz |
bm: no longer depends on which
-rwxr-xr-x | bm | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -7,7 +7,6 @@ use File::Basename qw<basename dirname>; use File::Find qw<find>; use File::Glob qw<:bsd_glob :nocase>; use File::Path qw<make_path>; -use File::Which qw<which>; use IPC::Open2 qw<open2>; use List::Util qw<all>; @@ -16,8 +15,13 @@ use JSON qw<decode_json>; my $BMDIR = "$ENV{HOME}/.bm"; mkdir $BMDIR || die $!; -my $YT = which('yt'); -my $GIT = "git -C '$BMDIR'" if which('git') && -d "$BMDIR/.git"; +sub exists_cmd { + my $cmd = shift; + return `sh -c 'command -v $cmd'`; +} + +my $YT = exists_cmd('yt'); +my $GIT = "git -C '$BMDIR'" if exists_cmd('git') && -d "$BMDIR/.git"; sub is_uri { my $text = shift; |