X-Git-Url: https://git.nmode.ca/Fey/blobdiff_plain/954db7dc2771873586af19231ebb19a9c2dbdbae..4e138f7a2baf0a4565bd82a3757ed5da97f56549:/lib/App/Fey.pm diff --git a/lib/App/Fey.pm b/lib/App/Fey.pm index 7b287f0..8b802a0 100644 --- a/lib/App/Fey.pm +++ b/lib/App/Fey.pm @@ -27,6 +27,13 @@ sub launch { my $self = shift; my $options = ref $_[0] ? shift : {}; + if (!(-t STDIN)) { + _read_stdin(\@_); + } + if (!@_ || $options->{interactive}) { + open STDIN, '<', '/dev/tty'; + _read_stdin(\@_); + } die "No files or URIs specified.\n" unless @_; if ($options->{group}) { @@ -129,6 +136,13 @@ sub _get_handler { } } +sub _read_stdin { + for my $file_or_uri () { + chomp $file_or_uri; + push @{ $_[0] }, $file_or_uri; + } +} + sub fey { App::Fey->new(ref $_[0] ? $_[0] : {})->launch(@_); }