Added fancyline usage
This commit is contained in:
parent
b5cfcf0555
commit
e2b909a191
3 changed files with 29 additions and 3 deletions
|
@ -20,10 +20,22 @@ shards:
|
||||||
git: https://github.com/axentro/crystal-argon2.git
|
git: https://github.com/axentro/crystal-argon2.git
|
||||||
version: 0.1.3
|
version: 0.1.3
|
||||||
|
|
||||||
|
cute:
|
||||||
|
git: https://github.com/papierkorb/cute.git
|
||||||
|
version: 0.4.0
|
||||||
|
|
||||||
db:
|
db:
|
||||||
git: https://github.com/crystal-lang/crystal-db.git
|
git: https://github.com/crystal-lang/crystal-db.git
|
||||||
version: 0.10.1
|
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:
|
granite:
|
||||||
git: https://github.com/amberframework/granite.git
|
git: https://github.com/amberframework/granite.git
|
||||||
version: 0.23.0
|
version: 0.23.0
|
||||||
|
|
|
@ -34,3 +34,5 @@ dependencies:
|
||||||
github: mrrooijen/commander
|
github: mrrooijen/commander
|
||||||
compiled_license:
|
compiled_license:
|
||||||
github: grimmigerFuchs/compiled_license
|
github: grimmigerFuchs/compiled_license
|
||||||
|
fancyline:
|
||||||
|
github: Papierkorb/fancyline
|
||||||
|
|
|
@ -1,15 +1,27 @@
|
||||||
require "commander"
|
require "commander"
|
||||||
require "compiled_license"
|
require "compiled_license"
|
||||||
|
require "fancyline"
|
||||||
|
|
||||||
require "./db"
|
require "./db"
|
||||||
|
|
||||||
module MW
|
module MW
|
||||||
module Cli
|
module CLI
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
|
private FANCY = Fancyline.new
|
||||||
|
|
||||||
|
FANCY.actions.set Fancyline::Key::Control::CtrlC do
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
|
||||||
private def input(prompt : String) : String
|
private def input(prompt : String) : String
|
||||||
print prompt
|
x = FANCY.readline(prompt)
|
||||||
(gets || "").chomp.strip
|
|
||||||
|
if x
|
||||||
|
x.chomp.strip
|
||||||
|
else
|
||||||
|
""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cli = Commander::Command.new do |cmd|
|
cli = Commander::Command.new do |cmd|
|
||||||
|
|
Loading…
Reference in a new issue