Skip to content

Instantly share code, notes, and snippets.

@RX14
Forked from maxpowa/something.cr
Created June 28, 2016 20:52
Show Gist options
  • Save RX14/0a5dd914fb66714e955d1f7ec4f3835b to your computer and use it in GitHub Desktop.
Save RX14/0a5dd914fb66714e955d1f7ec4f3835b to your computer and use it in GitHub Desktop.
require "../flag.cr"
class ExecuteFlag < Blerp::CommandFlag
@name = :execute
@key = "-e"
@description = "EXECUTE SOMETHING"
def processor(parser, data)
command = data.has_key?(:opposite) ? "nothing" : "something"
output = MemoryIO.new
Process.run(command, shell: true, output: output, error: output)
output.close
data[:output].as(Array(String)) << output.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment