Merge pull request 'Clean up CLI' (#48) from clean-up-cli into main
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #48
This commit is contained in:
Dominic Grimm 2022-02-09 16:34:22 +00:00
commit 243fe6ceec
6 changed files with 33 additions and 14 deletions

View file

@ -8,10 +8,6 @@ shards:
git: https://github.com/mrrooijen/commander.git git: https://github.com/mrrooijen/commander.git
version: 0.4.0 version: 0.4.0
compiled_license:
git: https://git.dergrimm.net/dergrimm/compiled_license.git
version: 2.0.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
@ -80,6 +76,10 @@ shards:
git: https://github.com/ysbaddaden/pool.git git: https://github.com/ysbaddaden/pool.git
version: 0.2.4 version: 0.2.4
pretty:
git: https://github.com/maiha/pretty.cr.git
version: 1.1.1
promise: promise:
git: https://github.com/spider-gazelle/promise.git git: https://github.com/spider-gazelle/promise.git
version: 3.0.0 version: 3.0.0
@ -104,6 +104,10 @@ shards:
git: https://github.com/spider-gazelle/secrets-env.git git: https://github.com/spider-gazelle/secrets-env.git
version: 1.3.1 version: 1.3.1
shard:
git: https://github.com/maiha/shard.cr.git
version: 0.3.1
version_from_shard: version_from_shard:
git: https://github.com/hugopl/version_from_shard.git git: https://github.com/hugopl/version_from_shard.git
version: 1.2.5 version: 1.2.5

View file

@ -34,8 +34,6 @@ dependencies:
github: spider-gazelle/secrets-env github: spider-gazelle/secrets-env
quartz_mailer: quartz_mailer:
github: amberframework/quartz-mailer github: amberframework/quartz-mailer
version_from_shard:
github: hugopl/version_from_shard
kilt: kilt:
github: jeromegn/kilt github: jeromegn/kilt
email: email:
@ -50,5 +48,5 @@ dependencies:
github: spider-gazelle/crystal-ldap github: spider-gazelle/crystal-ldap
ldap_escape: ldap_escape:
git: https://git.dergrimm.net/dergrimm/ldap_escape.git git: https://git.dergrimm.net/dergrimm/ldap_escape.git
compiled_license: shard:
git: https://git.dergrimm.net/dergrimm/compiled_license.git github: maiha/shard.cr

View file

@ -0,0 +1,5 @@
require "shard"
module Backend
AUTHORS = Shard.authors
end

View file

@ -0,0 +1,3 @@
module Backend
LICENSE = {{ read_file "LICENSE" }}
end

View file

@ -1,5 +1,5 @@
require "version_from_shard" require "shard"
module Backend module Backend
VersionFromShard.declare VERSION = Shard.version
end end

View file

@ -1,5 +1,4 @@
require "commander" require "commander"
require "compiled_license"
require "../backend" require "../backend"
cli = Commander::Command.new do |cmd| cli = Commander::Command.new do |cmd|
@ -21,12 +20,22 @@ cli = Commander::Command.new do |cmd|
end end
cmd.commands.add do |c| cmd.commands.add do |c|
c.use = "licenses" c.use = "authors"
c.short = "Prints licenses of projects used" c.short = "Prints authors"
c.long = c.short c.long = c.short
c.run do c.run do
puts CompiledLicense::LICENSES puts Backend::AUTHORS.join("\n")
end
end
cmd.commands.add do |c|
c.use = "license"
c.short = "Prints license"
c.long = c.short
c.run do
puts Backend::LICENSE
end end
end end