Commit e22bdfb
lib/jive/cli.rb
@@ -1,8 +1,10 @@
# frozen_string_literal: true
+require "pathname"
require "thor"
+require "yaml"
+
require "jive"
-require "pathname"
module Jive
module Cli
@@ -25,6 +27,23 @@ module Jive
end
end
+ desc "exec <command>", "run command from jive.yml"
+ def exec(command)
+ path = Pathname.pwd.join("jive.yml")
+ if path.exist?
+ runner.run_safely do
+ runner.execute(
+ YAML
+ .safe_load(path.read)
+ .dig("commands", command)
+ )
+ end
+ else
+ say "Error: jive.yml not found"
+ exit 2
+ end
+ end
+
desc "setup", "provide instructions to integrate into shell"
def setup
say <<~MESSAGE
jive.yml
@@ -0,0 +1,5 @@
+---
+commands:
+ autofix: ./bin/style -A
+ style: ./bin/style
+ test: ./bin/test