Class: Space::Core::CLI::Shell::Fish
- Inherits:
-
BaseCommand
- Object
- Dry::CLI::Command
- BaseCommand
- Space::Core::CLI::Shell::Fish
- Defined in:
- lib/space_core/cli/shell.rb
Instance Method Summary collapse
Methods included from Helpers
#display_date, #handle_errors, #project_config, #render, #setup_terminal, #state, #store, #terminal
Instance Method Details
#call(subcommand: "install", force: false, **opts) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/space_core/cli/shell.rb', line 23 def call(subcommand: "install", force: false, **opts) setup_terminal(**opts.slice(:color, :colors)) handle_errors do case subcommand when "install" result = Space::Core::ShellIntegration.install("fish", env: project_config.env, force: force) terminal.success (result.fetch(:action), result.fetch(:path)) terminal.success (result.fetch(:completions_action), result.fetch(:completions_path)) terminal.say "Restart fish to load the integration in this terminal: exec fish" when "uninstall" result = Space::Core::ShellIntegration.uninstall("fish", env: project_config.env, force: force) terminal.success (result.fetch(:action), result.fetch(:path)) terminal.success (result.fetch(:completions_action), result.fetch(:completions_path)) when "path" terminal.say "Function: #{terminal.path(Space::Core::ShellIntegration.path_for('fish', env: project_config.env))}" terminal.say "Completions: #{terminal.path(Space::Core::ShellIntegration.completions_path_for('fish', env: project_config.env))}" else err.puts "Usage: space shell fish [install|uninstall|path]" CLI.record_outcome(Outcome.new(exit_code: 1)) next end CLI.record_outcome(Outcome.new(exit_code: 0)) end end |