feat: add base classes for handling completion
This commit is contained in:
parent
a51ce2e98f
commit
b1567a1aa0
3 changed files with 51 additions and 0 deletions
17
src/commands/completion_autodetect.cr
Normal file
17
src/commands/completion_autodetect.cr
Normal 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
|
17
src/commands/completion_bash.cr
Normal file
17
src/commands/completion_bash.cr
Normal 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
|
17
src/commands/completion_zsh.cr
Normal file
17
src/commands/completion_zsh.cr
Normal 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
|
Loading…
Reference in a new issue