Skip to content

Instantly share code, notes, and snippets.

@maxpowa
Created June 28, 2016 20:40
Show Gist options
  • Save maxpowa/1140d8820afdf5a4c2bd0ff06ffd31ba to your computer and use it in GitHub Desktop.
Save maxpowa/1140d8820afdf5a4c2bd0ff06ffd31ba to your computer and use it in GitHub Desktop.
require "../flag.cr"
class ExecuteFlag < Blerp::CommandFlag
def name
:execute
end
def key
"-e"
end
def description
"EXECUTE SOMETHING"
end
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