From 3244130a51058e8cf7fc632b011c8ee6ed20fd4c Mon Sep 17 00:00:00 2001 From: Glenn Date: Wed, 3 Jan 2024 17:03:40 +0100 Subject: [PATCH] feat: add version --- shard.lock | 4 ++++ shard.yml | 2 ++ src/config.cr | 6 ++++++ src/version.cr | 11 +++++++++++ 4 files changed, 23 insertions(+) create mode 100644 src/version.cr diff --git a/shard.lock b/shard.lock index 8396546..330b2eb 100644 --- a/shard.lock +++ b/shard.lock @@ -4,6 +4,10 @@ shards: git: https://github.com/dscottboggs/magic.cr.git version: 1.1.0 + version_from_shard: + git: https://github.com/hugopl/version_from_shard.git + version: 1.2.5 + walk: git: https://github.com/alexherbo2/walk.cr.git version: 0.1.0+git.commit.765d758c0f966cccc98c1d81c7ccd0c1f71928e3 diff --git a/shard.yml b/shard.yml index c159cca..c664a22 100644 --- a/shard.yml +++ b/shard.yml @@ -14,6 +14,8 @@ dependencies: github: dscottboggs/magic.cr walk: github: alexherbo2/walk.cr + version_from_shard: + github: hugopl/version_from_shard # description: | # Short description of chatgpt-preloader diff --git a/src/config.cr b/src/config.cr index 7025b2c..d0c29c4 100644 --- a/src/config.cr +++ b/src/config.cr @@ -2,6 +2,7 @@ require "option_parser" require "yaml" require "./models/root_config" +require "./version" module CodePreloader class Config @@ -58,6 +59,11 @@ module CodePreloader @footer_prompt_file_path = footer_prompt_file end + parser.on("--version", "Show version") do + STDOUT.puts "#{PROGRAM_NAME} #{VERSION}" + exit(0) + end + parser.on("-h", "--help", "Show this help") do STDERR.puts parser exit diff --git a/src/version.cr b/src/version.cr new file mode 100644 index 0000000..d581f9b --- /dev/null +++ b/src/version.cr @@ -0,0 +1,11 @@ + +require "version_from_shard" + +module CodePreloader + PROGRAM_NAME = "CodePreloader" + VersionFromShard.declare +end + +# Nom du script et version +# SCRIPT_NAME = "SignalSpamReporter" +# SCRIPT_VERSION = "1.2"