cosmic-term icon indicating copy to clipboard operation
cosmic-term copied to clipboard

Add --version and --help with clap_lex

Open LinuxBoy-96 opened this issue 9 months ago • 7 comments

This is a better version of my previous attempt. This ensures that cosmic-term can provide its version and some information via the terminal. This is essential for when multiple distributions start using COSMIC.

Clap has the benefit of managing the version automatically by reading Cargo.toml.

Note that my objective is to implement it in most COSMIC apps.

LinuxBoy-96 avatar Mar 17 '25 19:03 LinuxBoy-96

Well it seem fine now.

LinuxBoy-96 avatar Mar 23 '25 19:03 LinuxBoy-96

This feature now has the same structure as in cosmic-greeter, which has been merged and cosmic-player.

LinuxBoy-96 avatar Mar 24 '25 21:03 LinuxBoy-96

What happened to the parsing of --no-daemon?

jackpot51 avatar Mar 26 '25 21:03 jackpot51

What happened to the parsing of --no-daemon?

it's still there after my code, between line 111 and 143.

However @mmstick did a great job with cosmic-greeter, puting my code in argparse.rs. So that's an options if you don't want that code there.

LinuxBoy-96 avatar Mar 26 '25 21:03 LinuxBoy-96

I do think the argument parsing must be unified and the help text must mention all possible flags and arguments.

jackpot51 avatar Mar 26 '25 21:03 jackpot51

I do think the argument parsing must be unified and the help text must mention all possible flags and arguments.

So I did a thing, hope it's not that bad... I have no objection into having a argparse.rs files from that point.

LinuxBoy-96 avatar Mar 26 '25 22:03 LinuxBoy-96

@jackpot51 My stripped binary size is 36120 KB, 16 BB smaller than the official. So it seem like a clean and efficient way to do it.

If you like it, maybe using vergen and clap_lex should be standardized across all COSMIC apps.

LinuxBoy-96 avatar Mar 27 '25 09:03 LinuxBoy-96