bin/hey: derive target host from --flake argument
This commit is contained in:
parent
60ca8b192b
commit
fcc7366f83
8
bin/hey
8
bin/hey
|
@ -27,7 +27,7 @@ module Hey
|
|||
extend self
|
||||
Command = Struct.new(:name, :desc, :args, :opts, :fn)
|
||||
|
||||
@@opts = { flake: File.expand_path('../', File.dirname(__FILE__)) }
|
||||
@@opts = {}
|
||||
@@alias = {}
|
||||
@@commands = {}
|
||||
@@cli = nil
|
||||
|
@ -358,6 +358,12 @@ module Hey
|
|||
opt.on(*%w{-i -A -q -e -p}, "Forward to nix-env") { sh ["nix-env", *ARGV]; exit }
|
||||
end
|
||||
opts.order!(args, into: @@opts)
|
||||
if @@opts[:flake] and @@opts[:flake].include? "#"
|
||||
@@opts[:flake], @@opts[:host] = @@opts[:flake].split '#'
|
||||
end
|
||||
if not @@opts[:flake] or @@opts[:flake].empty?
|
||||
@@opts[:flake] = File.expand_path('../', File.dirname(__FILE__))
|
||||
end
|
||||
|
||||
begin
|
||||
args.unshift("help") if @@opts[:help]
|
||||
|
|
Loading…
Reference in a new issue