feat: add base classes for handling completion

This commit is contained in:
Glenn Y. Rolland 2024-08-04 22:14:10 +02:00
parent a51ce2e98f
commit b1567a1aa0
3 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,17 @@
require "./abstract_command"
module GX::Commands
class CompletionAutodetect < AbstractCommand
def initialize(@config : GX::Config)
end
def execute
STDERR.puts "FIXME: Completion auto-detection isn't implemented yet. Please select one of the following: --bash or --zsh"
exit(0)
end
def self.handles_mode
GX::Types::Mode::CompletionAutodetect
end
end
end

View file

@ -0,0 +1,17 @@
require "./abstract_command"
module GX::Commands
class CompletionBash < AbstractCommand
def initialize(@config : GX::Config)
end
def execute
completion_bash = FileStorage.get("completion.bash")
STDOUT.puts completion_bash.gets_to_end
end
def self.handles_mode
GX::Types::Mode::CompletionBash
end
end
end

View file

@ -0,0 +1,17 @@
require "./abstract_command"
module GX::Commands
class CompletionZsh < AbstractCommand
def initialize(@config : GX::Config)
end
def execute
completion_bash = FileStorage.get("completion.zsh")
STDOUT.puts completion_bash.gets_to_end
end
def self.handles_mode
GX::Types::Mode::CompletionZsh
end
end
end