lib/idonethis/use_cases/cli.rb in idonethis-cli-0.14.0 vs lib/idonethis/use_cases/cli.rb in idonethis-cli-0.14.1
- old
+ new
@@ -15,11 +15,11 @@
args.merge!({ opts: rest, log: log, internet: internet, view: views[:list]})
log.call "args: #{args}, command: #{command}, rest: #{rest}"
- use_case = choose command.to_sym, adapters, rest
+ use_case = choose command.to_sym, adapters, views, rest
unless use_case
log.call "No command <#{command.to_sym}> found"
return
end
@@ -27,21 +27,21 @@
use_case.call settings.credential, args
end
private
- def choose(command, adapters, opts)
+ def choose(command, adapters, views, opts)
use_cases = {
list: Idonethis::UseCases::List.method(:apply),
new: Idonethis::UseCases::New.method(:apply),
config: Idonethis::UseCases::Config.method(:apply),
git: ->(_, args) { Idonethis::UseCases::Git.apply(_, args.merge(git: adapters[:git], view: ->(msg) { puts msg }, fs: adapters[:fs]))},
help: ->(credential, args) { puts "TODO: implement help" }
}
if command == :list && opts.include?("teams")
return ->(credential, args) {
- Idonethis::UseCases::Teams.apply(credential, args.merge(view: views[:teans]))
+ Idonethis::UseCases::Teams.apply(credential, args.merge(view: views[:teams]))
}
end
use_case = use_cases[command]
end