saikyun / freja

Self-modifiable editor for coding graphical things
68 stars 3 forks source link

Be able to identify freja version from the binary #20

Closed saikyun closed 3 years ago

saikyun commented 3 years ago

E.g. display specific commit used when building.

sogaiu commented 3 years ago

May be this is along the same lines as being able to invoke freja --version and get back some version info?

I guess one reason to have this kind of functionality is for clarity when discussing issues.

Another reason is so that other programs can check for the existence of freja without it leading to the GUI showing up, but possibly also to obtain version information at the same time if freja is reachable via a directory listed in PATH.

If possible, please include freja's name as part of the output. Below are some examples of what some other programs do:

Note that kakoune went with -version and not --version unlike the others.

Not so nice was the output for fzf --version, which doesn't mention it's fzf, it's just a version number followed by something in parentheses.

On a somewhat related note, ctags can end up referring to significantly different implementations. On Ubuntu, ctags-universal can end up as the executable name instead of ctags, but this is not necessarily the case elsewhere. Luckily, examining the output of ctags --version appears to be sufficient to tell "Universal Ctags" apart from other versions.

saikyun commented 3 years ago

Do you know how to get code from running a bash script into a Janet program? I don't really want to force Freja to be dependent on eg git to get the commit. Maybe it could be fed as a environment variable when running or building. Is this something that could be done in project.janet?

Den tis 31 aug. 2021 14:20sogaiu @.***> skrev:

May be this is along the same lines as being able to invoke freja --version and get back some version info?

I guess one reason to have this kind of functionality is for clarity when discussing issues.

Another reason is so that other programs can check for the existence of freja without it leading to the GUI showing up, but possibly also to obtain version information at the same time if freja is reachable via a directory listed in PATH.

If possible, please include freja's name as part of the output. Below are some examples of what some other programs do:

  • emacs --version begins with "GNU Emacs"
  • kak -version begins with "Kakoune"
  • nvim --version begins with "NVIM"
  • vim --version begins with "VIM"

Note that kakoune went with -version and not --version unlike the others.

Not so nice was the output for fzf --version, which doesn't mention it's fzf, it's just a version number followed by something in parentheses.

On a somewhat related note, ctags can end up referring to significantly different implementations. On Ubuntu, ctags-universal can end up as the executable name instead of ctags, but this is not necessarily the case elsewhere. Luckily, examining the output of ctags --version appears to be sufficient to tell "Universal ctags" apart from other versions.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/saikyun/freja/issues/20#issuecomment-909185232, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS46ZYCLXOCHOCE2LSKZEDT7TCILANCNFSM47X6ANZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

saikyun commented 3 years ago

But what if a user running a pre-built binary doesn't have git? (latest git commit is what I figure I'd use as part of the version)

Den tis 31 aug. 2021 kl 16:41 skrev andrewchambers @.***

:

I would just load it into a global def - (def version (or (os/run ...) nil))

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/saikyun/freja/issues/20#issuecomment-909301498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS46ZZYWGXBW5VAGGXCA7TT7TSYVANCNFSM47X6ANZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

saikyun commented 3 years ago

Assuming you mean os/spawn, since it throws error when you don't have the program :(

Preferably I'd only set the version when running from source or building, in the built binary I'd want it to be static.

Den tis 31 aug. 2021 kl 17:22 skrev Jona Ekenberg @.***>:

But what if a user running a pre-built binary doesn't have git? (latest git commit is what I figure I'd use as part of the version)

Den tis 31 aug. 2021 kl 16:41 skrev andrewchambers < @.***>:

I would just load it into a global def - (def version (or (os/run ...) nil))

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/saikyun/freja/issues/20#issuecomment-909301498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS46ZZYWGXBW5VAGGXCA7TT7TSYVANCNFSM47X6ANZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

andrewchambers commented 3 years ago

top level defs are run at compile time not runtime... the user doesn't need anything.

saikyun commented 3 years ago

Oh, right, haha. Thanks!

Den tis 31 aug. 2021 17:27andrewchambers @.***> skrev:

defs are run at compile time not runtime...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/saikyun/freja/issues/20#issuecomment-909341928, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS46Z4P5NJLOROXGHWBLFLT7TYFVANCNFSM47X6ANZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

saikyun commented 3 years ago

Fixed with #32 , thanks again @sogaiu :) And thanks @andrewchambers for the input.