Stick to standard --version

This commit is contained in:
Aoran Zeng 2024-08-19 11:28:51 +08:00
parent 9009bd6d9b
commit 4e349aa583
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
4 changed files with 21 additions and 14 deletions

View File

@ -364,7 +364,7 @@ test_speed_url (const char *url)
char *curl_cmd = xy_strjoin (7, "curl -qsL ", ipv6, char *curl_cmd = xy_strjoin (7, "curl -qsL ", ipv6,
" -o " xy_os_devnull, " -o " xy_os_devnull,
" -w \"%{http_code} %{speed_download}\" -m", time_sec, " -w \"%{http_code} %{speed_download}\" -m", time_sec,
" -A chsrc/" Chsrc_Version " ", url); " -A chsrc/" Chsrc_Banner_Version " ", url);
// chsrc_info (xy_2strjoin ("测速命令 ", curl_cmd)); // chsrc_info (xy_2strjoin ("测速命令 ", curl_cmd));

View File

@ -16,7 +16,9 @@
* chsrc: Change Source * chsrc: Change Source
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#define Chsrc_Version "v0.1.7.3-2024/08/18" #define Chsrc_Version "0.1.7.3"
#define Chsrc_Release_Date "2024/08/18"
#define Chsrc_Banner_Version "v" Chsrc_Version "-" Chsrc_Release_Date
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc" #define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc" #define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
@ -267,18 +269,25 @@ cli_print_target_features (FeatInfo f, const char *input_target_name)
void void
cli_print_version () cli_print_version ()
{ {
puts (xy_strjoin (3, "chsrc: Change Source (GPL-3.0) ", say ("chsrc " Chsrc_Version);
xy_str_to_magenta (Chsrc_Version), " by RubyMetric")); say ("Copyright (C) 2024 Aoran Zeng, Heng Guo");
say ("License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>");
say ("This is free software: you are free to change and redistribute it.");
say ("There is NO WARRANTY, to the extent permitted by law.");
br();
say ("Written by Aoran Zeng, Heng Guo and contributors. (See chsrc.c)");
} }
void void
cli_print_help () cli_print_help ()
{ {
say (xy_strjoin (3, "chsrc: Change Source (GPLv3+) ",
to_purple (Chsrc_Banner_Version), " by RubyMetric"));
br(); br();
for (int i=0; i<xy_arylen (Chsrc_Usage); i++) for (int i=0; i<xy_arylen (Chsrc_Usage); i++)
{ {
puts (Chsrc_Usage[i]); say (Chsrc_Usage[i]);
} }
} }
@ -425,7 +434,6 @@ main (int argc, char const *argv[])
if (0==argc) if (0==argc)
{ {
cli_print_version ();
cli_print_help (); cli_print_help ();
return 0; return 0;
} }
@ -481,7 +489,6 @@ main (int argc, char const *argv[])
xy_streql (command, "help") || xy_streql (command, "help") ||
xy_streql (command, "--help")) xy_streql (command, "--help"))
{ {
cli_print_version ();
cli_print_help (); cli_print_help ();
return 0; return 0;
} }

View File

@ -70,7 +70,7 @@ ensure_apt_sourcelist (int debian_type)
if (debian_type == OS_Is_Ubuntu) if (debian_type == OS_Is_Ubuntu)
{ {
makeup = xy_strjoin (9, makeup = xy_strjoin (9,
"# Generated by chsrc " Chsrc_Version "\n\n" "# Generated by chsrc " Chsrc_Banner_Version "\n\n"
"deb " Chsrc_Maintain_URL "/ubuntu ", codename, " main restricted universe multiverse\n" "deb " Chsrc_Maintain_URL "/ubuntu ", codename, " main restricted universe multiverse\n"
"deb " Chsrc_Maintain_URL "/ubuntu ", codename, "-updates main restricted universe multiverse\n" "deb " Chsrc_Maintain_URL "/ubuntu ", codename, "-updates main restricted universe multiverse\n"
"deb " Chsrc_Maintain_URL "/ubuntu ", codename, "-backports main restricted universe multiverse\n" "deb " Chsrc_Maintain_URL "/ubuntu ", codename, "-backports main restricted universe multiverse\n"
@ -84,7 +84,7 @@ ensure_apt_sourcelist (int debian_type)
// https://mirrors.tuna.tsinghua.edu.cn/help/debian/ // https://mirrors.tuna.tsinghua.edu.cn/help/debian/
// 从 Debian 12 开始,开始有一项 non-free-firmware // 从 Debian 12 开始,开始有一项 non-free-firmware
makeup = xy_strjoin (9, makeup = xy_strjoin (9,
"# Generated by chsrc " Chsrc_Version "\n\n" "# Generated by chsrc " Chsrc_Banner_Version "\n\n"
"deb " Chsrc_Maintain_URL "/debian ", codename, " main contrib non-free non-free-firmware\n" "deb " Chsrc_Maintain_URL "/debian ", codename, " main contrib non-free non-free-firmware\n"
"deb " Chsrc_Maintain_URL "/debian ", codename, "-updates main contrib non-free non-free-firmware\n" "deb " Chsrc_Maintain_URL "/debian ", codename, "-updates main contrib non-free non-free-firmware\n"
"deb " Chsrc_Maintain_URL "/debian ", codename, "-backports main contrib non-free non-free-firmware\n" "deb " Chsrc_Maintain_URL "/debian ", codename, "-backports main contrib non-free non-free-firmware\n"
@ -94,7 +94,7 @@ ensure_apt_sourcelist (int debian_type)
else if (version >= 11) else if (version >= 11)
{ {
makeup = xy_strjoin (9, makeup = xy_strjoin (9,
"# Generated by chsrc " Chsrc_Version "(" Chsrc_Maintain_URL ")\n\n" "# Generated by chsrc " Chsrc_Banner_Version "(" Chsrc_Maintain_URL ")\n\n"
"deb " Chsrc_Maintain_URL "/debian ", codename, " main contrib non-free\n" "deb " Chsrc_Maintain_URL "/debian ", codename, " main contrib non-free\n"
"deb " Chsrc_Maintain_URL "/debian ", codename, "-updates main contrib non-free\n" "deb " Chsrc_Maintain_URL "/debian ", codename, "-updates main contrib non-free\n"
"deb " Chsrc_Maintain_URL "/debian ", codename, "-backports main contrib non-free\n" "deb " Chsrc_Maintain_URL "/debian ", codename, "-backports main contrib non-free\n"
@ -103,7 +103,7 @@ ensure_apt_sourcelist (int debian_type)
else if (version >= 10) else if (version >= 10)
{ {
makeup = xy_strjoin (9, makeup = xy_strjoin (9,
"# Generated by chsrc " Chsrc_Version "(" Chsrc_Maintain_URL ")\n\n" "# Generated by chsrc " Chsrc_Banner_Version "(" Chsrc_Maintain_URL ")\n\n"
"deb " Chsrc_Maintain_URL "/debian ", codename, " main contrib non-free\n" "deb " Chsrc_Maintain_URL "/debian ", codename, " main contrib non-free\n"
"deb " Chsrc_Maintain_URL "/debian ", codename, "-updates main contrib non-free\n" "deb " Chsrc_Maintain_URL "/debian ", codename, "-updates main contrib non-free\n"
"deb " Chsrc_Maintain_URL "/debian ", codename, "-backports main contrib non-free\n" "deb " Chsrc_Maintain_URL "/debian ", codename, "-backports main contrib non-free\n"

View File

@ -47,7 +47,7 @@ wr_homebrew_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (wr_homebrew); chsrc_yield_source_and_confirm (wr_homebrew);
char *splitter = "\n\n# Generated by chsrc " Chsrc_Version; char *splitter = "\n\n# Generated by chsrc " Chsrc_Banner_Version;
char *api_domain = xy_strjoin (3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles/api"), "\""); char *api_domain = xy_strjoin (3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles/api"), "\"");
char *bottle_domain = xy_strjoin (3, "export HOMEBREW_BOTTLE_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles"), "\""); char *bottle_domain = xy_strjoin (3, "export HOMEBREW_BOTTLE_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles"), "\"");
char *brew_git_remote = xy_strjoin (3, "export HOMEBREW_BREW_GIT_REMOTE=\"", xy_2strjoin (source.url, "git/homebrew/brew.git"), "\""); char *brew_git_remote = xy_strjoin (3, "export HOMEBREW_BREW_GIT_REMOTE=\"", xy_2strjoin (source.url, "git/homebrew/brew.git"), "\"");