Added fancyline usage
This commit is contained in:
parent
b5cfcf0555
commit
e2b909a191
|
@ -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
|
||||
|
|
|
@ -34,3 +34,5 @@ dependencies:
|
|||
github: mrrooijen/commander
|
||||
compiled_license:
|
||||
github: grimmigerFuchs/compiled_license
|
||||
fancyline:
|
||||
github: Papierkorb/fancyline
|
||||
|
|
|
@ -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|
|
||||
|
|
Loading…
Reference in a new issue