lib/jive/cli.rb in jive-0.2.2 vs lib/jive/cli.rb in jive-0.2.3

- old
+ new

@@ -1,28 +1,36 @@ # frozen_string_literal: true +require "pathname" require "thor" +require "yaml" + require "jive" -require "pathname" module Jive module Cli class App < Thor def self.exit_on_failure? true end desc "cd <org>/<project>", "cd to ~/src/github.com/<org>/<project>" def cd(slug) - runner.run_safely do - Git.new(runner).cd(slug) - end + runner.run_safely { Git.new(runner).cd(slug) } end desc "clone <org>/<project>", "git clone to ~/src/github.com/<org>/<project>" def clone(slug) + runner.run_safely { Git.new(runner).clone(slug) } + end + + desc "exec <command>", "run command from jive.yml" + def exec(command) + path = Pathname.pwd.join("jive.yml") + return shell.error("Error: jive.yml not found") unless path.exist? + runner.run_safely do - Git.new(runner).clone(slug) + runner.execute(YAML.safe_load(path.read).dig("commands", command)) end end desc "setup", "provide instructions to integrate into shell" def setup