Add connect, disconnect, up, & down commands

This commit is contained in:
0x1eef 2023-12-07 07:18:16 -03:00
parent b3cd9d14fb
commit e29ab05c58
13 changed files with 73 additions and 1 deletions

View file

@ -1,4 +1,5 @@
# frozen_string_literal: true
source "https://rubygems.org"
gem "cmd.rb", github: "0x1eef/cmd.rb"
gem "ryo.rb", github: "0x1eef/ryo.rb"
gemspec

1
bin/twenty Executable file
View file

@ -0,0 +1 @@
#!/usr/bin/env ruby

3
lib/twenty.rb Normal file
View file

@ -0,0 +1,3 @@
module Twenty
require_relative "twenty/command"
end

8
lib/twenty/command.rb Normal file
View file

@ -0,0 +1,8 @@
require "cmd"
class Twenty::Command < Cmd
require_relative "command/up"
require_relative "command/down"
require_relative "command/connect"
require_relative "command/disconnect"
end

View file

@ -0,0 +1,15 @@
class Twenty::Command::Connect < Twenty::Command
set_banner usage: "twenty connect [OPTIONS]",
description: "Connect a project to twenty"
def run
options = parse_options(argv)
options.help ? show_help : run_command
end
private
def run_command
warn "[twenty] connect..."
end
end

View file

@ -0,0 +1,15 @@
class Twenty::Command::Disconnect < Twenty::Command
set_banner usage: "twenty disconnect [OPTIONS]",
description: "Disconnect a project from twenty"
def run
options = parse_options(argv)
options.help ? show_help : run_command
end
private
def run_command
warn "[twenty] disconnect..."
end
end

View file

@ -0,0 +1,15 @@
class Twenty::Command::Down < Twenty::Command
set_banner usage: "twenty down [OPTIONS]",
description: "Stop the twenty web server"
def run
options = parse_options(argv)
options.help ? show_help : run_command
end
private
def run_command
warn "[twenty] down..."
end
end

15
lib/twenty/command/up.rb Normal file
View file

@ -0,0 +1,15 @@
class Twenty::Command::Up < Twenty::Command
set_banner usage: "twenty up [OPTIONS]",
description: "Start the twenty web server"
def run
options = parse_options(argv)
options.help ? show_help : run_command
end
private
def run_command
warn "[twenty] up..."
end
end

0
libexec/twenty/connect Normal file
View file

View file

0
libexec/twenty/down Normal file
View file

0
libexec/twenty/up Normal file
View file

View file

@ -16,6 +16,5 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "yard", "~> 0.9"
gem.add_development_dependency "redcarpet", "~> 3.5"
gem.add_development_dependency "standard", "~> 1.13"
gem.add_development_dependency "test-cmd.rb", "~> 0.2"
gem.add_development_dependency "rake", "~> 13.1"
end