diff --git a/docker/backend/shard.lock b/docker/backend/shard.lock index c051c28..314bba3 100644 --- a/docker/backend/shard.lock +++ b/docker/backend/shard.lock @@ -20,10 +20,22 @@ shards: git: https://github.com/axentro/crystal-argon2.git version: 0.1.3 + cute: + git: https://github.com/papierkorb/cute.git + version: 0.4.0 + db: git: https://github.com/crystal-lang/crystal-db.git version: 0.10.1 + fancyline: + git: https://github.com/papierkorb/fancyline.git + version: 0.4.1 + + future: + git: https://github.com/crystal-community/future.cr.git + version: 1.0.0 + granite: git: https://github.com/amberframework/granite.git version: 0.23.0 diff --git a/docker/backend/shard.yml b/docker/backend/shard.yml index 12498d0..f4f656e 100644 --- a/docker/backend/shard.yml +++ b/docker/backend/shard.yml @@ -34,3 +34,5 @@ dependencies: github: mrrooijen/commander compiled_license: github: grimmigerFuchs/compiled_license + fancyline: + github: Papierkorb/fancyline diff --git a/docker/backend/src/mw/cli.cr b/docker/backend/src/mw/cli.cr index 266c040..891ab2b 100644 --- a/docker/backend/src/mw/cli.cr +++ b/docker/backend/src/mw/cli.cr @@ -1,15 +1,27 @@ require "commander" require "compiled_license" +require "fancyline" require "./db" module MW - module Cli + module CLI extend self + private FANCY = Fancyline.new + + FANCY.actions.set Fancyline::Key::Control::CtrlC do + exit + end + private def input(prompt : String) : String - print prompt - (gets || "").chomp.strip + x = FANCY.readline(prompt) + + if x + x.chomp.strip + else + "" + end end cli = Commander::Command.new do |cmd|