Shell::DSL - Run and pipe commands from one to another like you would in Bash.

NAME

Shell::DSL - Run and pipe commands from one to another like you would in Bash.

NOTE: This module is not thread-safe.

Caveat: Although an implementation detail, this module currently depends on Bash to connect the pipes and to set up user specified I/O redirections for sub processes.

SYNOPSIS

use Shell::DSL;
my @words;
shell :!pipefail, {
    .curl<-fsSL https://en.wikipedia.org/wiki/Special:Random>
      |> .xmllint(Ā«--html --xpath '//*[name()!="script"]/text()' -Ā», (:w2</dev/null>))
      |> .tr<-cs A-Za-z  \n>
      |> .tr<A-Z a-z>
      |> .sort
      |> .uniq<-c>
      |> .sort<-rn>
      |> .head<-30>
      |> pb({
          for .lines {
              my $match = $_ ~~ /\s* \d+ ' ' (\w+)$/;
              next if !$match;
              @words.push: $match[0];
              .put;
          }
      })
      |> .nl;
}
put();
my $i = (^@words).pick;
say "The word, '@words[$i]', is No. {$i+1} in the list.";

See examples/ for more usage examples.

AUTHOR

Jack Kuan <[email protected]>

COPYRIGHT AND LICENSE Copyright 2020 Jack Kuan

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

Shell::DSL v0.0.4

Run commands and pipe from one to another like you would in a Unix command line shell.

Authors

  • Jack Kuan

License

Artistic-2.0

Dependencies

Fcntl:ver<0.0.2>

Test Dependencies

Provides

  • IO::PipeFD
  • Shell::DSL

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.