cli: shorten mixin names

This commit is contained in:
0x1eef 2024-01-16 17:46:47 -03:00
parent a017048b21
commit ed761c2418
9 changed files with 14 additions and 14 deletions

View file

@ -6,8 +6,8 @@ class Twenty::Command < Cmd
## ##
# mixins # mixins
require_relative "command/mixin/common_option_mixin" require_relative "command/mixin/common_option_mixin"
require_relative "command/mixin/pending_migration_mixin" require_relative "command/mixin/migration_mixin"
require_relative "command/mixin/sqlite_connection_mixin" require_relative "command/mixin/sqlite_mixin"
## ##
# commands # commands

View file

@ -3,8 +3,8 @@
class Twenty::Command::Connect < Twenty::Command class Twenty::Command::Connect < Twenty::Command
set_banner usage: "twenty connect [OPTIONS]", set_banner usage: "twenty connect [OPTIONS]",
description: "Connect a project to twenty" description: "Connect a project to twenty"
prepend Twenty::Command::PendingMigrationMixin prepend Twenty::Command::MigrationMixin
prepend Twenty::Command::SQLiteConnectionMixin prepend Twenty::Command::SQLiteMixin
def run def run
options = parse_options(argv) options = parse_options(argv)

View file

@ -4,8 +4,8 @@ class Twenty::Command::Console < Twenty::Command
set_banner usage: "twenty console [OPTIONS]", set_banner usage: "twenty console [OPTIONS]",
description: "Start the twenty developer console" description: "Start the twenty developer console"
include CommonOptionMixin include CommonOptionMixin
prepend Twenty::Command::PendingMigrationMixin prepend Twenty::Command::MigrationMixin
prepend Twenty::Command::SQLiteConnectionMixin prepend Twenty::Command::SQLiteMixin
def run def run
options = parse_options(argv) options = parse_options(argv)

View file

@ -3,8 +3,8 @@
class Twenty::Command::Disconnect < Twenty::Command class Twenty::Command::Disconnect < Twenty::Command
set_banner usage: "twenty disconnect [OPTIONS]", set_banner usage: "twenty disconnect [OPTIONS]",
description: "Disconnect a project from twenty" description: "Disconnect a project from twenty"
prepend Twenty::Command::PendingMigrationMixin prepend Twenty::Command::MigrationMixin
prepend Twenty::Command::SQLiteConnectionMixin prepend Twenty::Command::SQLiteMixin
def run def run
options = parse_options(argv) options = parse_options(argv)

View file

@ -3,7 +3,7 @@
class Twenty::Command::Down < Twenty::Command class Twenty::Command::Down < Twenty::Command
set_banner usage: "twenty down [OPTIONS]", set_banner usage: "twenty down [OPTIONS]",
description: "Stop the twenty web server" description: "Stop the twenty web server"
prepend Twenty::Command::SQLiteConnectionMixin prepend Twenty::Command::SQLiteMixin
def run def run
options = parse_options(argv) options = parse_options(argv)

View file

@ -4,7 +4,7 @@ class Twenty::Command::Migrate < Twenty::Command
set_banner usage: "twenty migrate [OPTIONS]", set_banner usage: "twenty migrate [OPTIONS]",
description: "Migrate the database" description: "Migrate the database"
include CommonOptionMixin include CommonOptionMixin
prepend Twenty::Command::SQLiteConnectionMixin prepend Twenty::Command::SQLiteMixin
def run def run
options = parse_options(argv) options = parse_options(argv)

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
module Twenty::Command::PendingMigrationMixin module Twenty::Command::MigrationMixin
def run_command(...) def run_command(...)
if pending_migrations? if pending_migrations?
warn "There are pending migrations.\n" \ warn "There are pending migrations.\n" \

View file

@ -1,4 +1,4 @@
module Twenty::Command::SQLiteConnectionMixin module Twenty::Command::SQLiteMixin
def run_command(options) def run_command(options)
path = options.database || Twenty.default_database path = options.database || Twenty.default_database
Twenty.establish_connection(path:) Twenty.establish_connection(path:)

View file

@ -4,8 +4,8 @@ class Twenty::Command::Up < Twenty::Command
set_banner usage: "twenty up [OPTIONS]", set_banner usage: "twenty up [OPTIONS]",
description: "Start the twenty web server" description: "Start the twenty web server"
include CommonOptionMixin include CommonOptionMixin
prepend Twenty::Command::PendingMigrationMixin prepend Twenty::Command::MigrationMixin
prepend Twenty::Command::SQLiteConnectionMixin prepend Twenty::Command::SQLiteMixin
def run def run
options = parse_options(argv) options = parse_options(argv)