aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillermo Ramos2022-01-12 15:43:39 +0100
committerGuillermo Ramos2022-01-12 15:43:39 +0100
commit0a584017ff7a375f250cd8e38aeedd19b3905f5e (patch)
tree4ca8e98e6c81695fdba2e33f860939e7df389f01
parente649822b6ae91793a79e2167483390e154acf331 (diff)
downloadcli-0a584017ff7a375f250cd8e38aeedd19b3905f5e.tar.gz
bm: no longer depends on which
-rwxr-xr-xbm10
1 files changed, 7 insertions, 3 deletions
diff --git a/bm b/bm
index 4573135..93bd8c8 100755
--- a/bm
+++ b/bm
@@ -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;