Acme-Claude-Shell
view release on metacpan or search on metacpan
bin/acme_claude_shell view on Meta::CPAN
#!/usr/bin/env perl
use 5.020;
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Acme::Claude::Shell qw(shell run);
use Getopt::Long;
use Term::ANSIColor qw(colored);
use Pod::Usage;
our $VERSION = '0.01';
my %opts = (
'dry-run' => 0,
'safe-mode' => 1,
'color' => -t STDOUT ? 1 : 0,
'dir' => '.',
);
GetOptions(
'dry-run|n' => \$opts{'dry-run'},
'unsafe|u' => sub { $opts{'safe-mode'} = 0 },
'no-color' => sub { $opts{'color'} = 0 },
'color!' => \$opts{'color'},
'directory|d=s' => \$opts{'dir'},
'command|c=s' => \$opts{'command'},
'model|m=s' => \$opts{'model'},
'help|h' => \$opts{'help'},
'version|v' => \$opts{'version'},
) or pod2usage(2);
if ($opts{'help'}) {
show_help();
exit 0;
}
if ($opts{'version'}) {
show_version();
exit 0;
}
# Check for piped input: acme_claude_shell -c - reads from stdin
my $command = $opts{'command'};
if (defined $command && $command eq '-') {
# Read command from stdin (for piping: echo "list files" | acme_claude_shell -c -)
local $/;
$command = <STDIN>;
chomp $command if defined $command;
}
# Single command mode or interactive
if (defined $command && length $command) {
run($command,
dry_run => $opts{'dry-run'},
safe_mode => $opts{'safe-mode'},
working_dir => $opts{'dir'},
colorful => $opts{'color'},
($opts{'model'} ? (model => $opts{'model'}) : ()),
);
} else {
shell(
dry_run => $opts{'dry-run'},
safe_mode => $opts{'safe-mode'},
working_dir => $opts{'dir'},
( run in 0.528 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )