cli: add "twenty console"
This commit is contained in:
parent
67a3cc7ead
commit
e076598f13
5 changed files with 34 additions and 0 deletions
|
@ -23,6 +23,7 @@ rather than in the cloud.
|
|||
connect Connect a project to twenty.
|
||||
disconnect Disconnect a project from twenty.
|
||||
migrate Migrate the database.
|
||||
console Start the twenty developer console.
|
||||
|
||||
## Install
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@ when "disconnect"
|
|||
when "migrate"
|
||||
wait spawn("migrate", *ARGV[1..])
|
||||
exit $?.exitstatus
|
||||
when "console"
|
||||
wait spawn("console", *ARGV[1..])
|
||||
exit $?.exitstatus
|
||||
else
|
||||
warn "Usage: twenty COMMAND [OPTIONS]\n\n" \
|
||||
"Commands:\n" \
|
||||
|
@ -28,4 +31,5 @@ else
|
|||
" connect Connect a project to twenty.\n" \
|
||||
" disconnect Disconnect a project from twenty.\n" \
|
||||
" migrate Migrate the database.\n" \
|
||||
" console Start the twenty developer console.\n" \
|
||||
end
|
||||
|
|
|
@ -6,4 +6,5 @@ class Twenty::Command < Cmd
|
|||
require_relative "command/connect"
|
||||
require_relative "command/disconnect"
|
||||
require_relative "command/migrate"
|
||||
require_relative "command/console"
|
||||
end
|
||||
|
|
16
twenty-cli/lib/twenty-cli/command/console.rb
Normal file
16
twenty-cli/lib/twenty-cli/command/console.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
class Twenty::Command::Console < Twenty::Command
|
||||
set_banner usage: "twenty console [OPTIONS]",
|
||||
description: "Start the twenty developer console"
|
||||
|
||||
def run
|
||||
options = parse_options(argv)
|
||||
options.help ? show_help : run_command
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def run_command
|
||||
require "irb"
|
||||
TOPLEVEL_BINDING.irb
|
||||
end
|
||||
end
|
12
twenty-cli/libexec/twenty/console
Executable file
12
twenty-cli/libexec/twenty/console
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
libdir = File.expand_path File.join(__dir__, "..", "..", "lib")
|
||||
require File.join(libdir, "twenty-cli")
|
||||
|
||||
##
|
||||
# main
|
||||
def main(argv)
|
||||
Twenty::Command::Console.new(argv).run
|
||||
end
|
||||
main(ARGV)
|
Loading…
Reference in a new issue