alefore / edge

Edge - a text editor
GNU General Public License v3.0
77 stars 2 forks source link

Missing -version option #8

Open kseistrup opened 10 months ago

kseistrup commented 10 months ago

Edge built from 8fdf7f76ffa167497a7e9e9228b26b1f2dcf95e9 has no -version/-V option:

$ edge -h
Usage: edge [OPTION]... [FILE]...

Supports the following options:
  -X                      If nested, exit early
  -ao                     Prompt for a path to open
  -benchmark <benchmark>  Run a benchmark
  -bg                     Open buffers given to -f in background
  -client, -c <path>      Connect to daemon at a given path
  -fork, -f <shellcmd>    Create a buffer running a shell command
  -fps <fps>              Frames per second
  -help, -h               Display help and exit
  -load, -l <path>        Load a file with VM commands
  -mute[=bool]            Disable audio output
  -p                      Enable advanced resolution for initial local paths: local paths given on the command line (in the invocation to Edge) will be looked up based on search paths (rather than simply attempting to open them as relative paths to the current working directory).
  -run <vmcmd>            Run a VM command
  -server, -s[=path]      Run in daemon mode (at an optional path)
  -tests <behavior>       Unit tests behavior
  -tests_filter <name>    Run specific tests
  -view <mode>            Widget mode

It would be much easier for everyone if e.g. edge -version could show relevant version information.

alefore commented 10 months ago

This makes sense to me. Thank you for suggesting it.

I guess ideally it would print the hash and time of the last commit in the repository being built, though I'll have to think a little bit about what's the cleanest way to implement that.

kseistrup commented 10 months ago

In ArchLinux AUR, packages that are built from the latest commit often use a form of git describe --long to calculate the version string, e.g.:

$ cd "$repo"
$ git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//g'
0.6.4.r1.gf89e790

So this is the first (or second, I can't remember if it's 0-based) commit in the “0.6.4” line, and the short git hash is “f89e790”.

This obviously only works if there are annotated tags.

See e.g.:

for more suggestions.

kseistrup commented 10 months ago

PS: But even a version string that doesn't have a date or commit hash would be better than nothing (e.g., just “v0.6.4” in the example above).