-
-
Save lukassup/3914b605ea1f77bae0a00a9af127227e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# vim: set ft=ruby: | |
# frozen_string_literal: true | |
require "bundler/setup" | |
require "dry/cli" | |
module ZX | |
module CLI | |
class SudoCommand < Dry::CLI::Command | |
option :sudo, type: :boolean, desc: 'Use sudo?' | |
end | |
module Commands | |
extend Dry::CLI::Registry | |
class Exec < SudoCommand | |
desc "Execute a task" | |
argument :task, type: :string, required: true, desc: "Task to be executed" | |
argument :dirs, type: :array, required: false, desc: "Optional directories" | |
def call(task:, dirs: [], **) | |
puts "exec - task: #{task}, dirs: #{dirs.inspect}" | |
end | |
end | |
register "exec", Exec | |
end | |
end | |
end | |
Dry::CLI.new(ZX::CLI::Commands).call | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment