Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wiremoons/app_version
Odin package to display application version information.
https://github.com/wiremoons/app_version
odin odin-lang version
Last synced: about 1 month ago
JSON representation
Odin package to display application version information.
- Host: GitHub
- URL: https://github.com/wiremoons/app_version
- Owner: wiremoons
- License: mit
- Created: 2023-06-11T20:14:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-18T11:00:26.000Z (about 1 year ago)
- Last Synced: 2024-04-21T10:17:27.731Z (8 months ago)
- Topics: odin, odin-lang, version
- Language: Odin
- Homepage:
- Size: 191 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-odin - App Version
- awesome-odin - App Version
README
# app_version
Odin package to generate and display application version information for command line applications.## Example output
Below is an example of `app_version` output when run on *macOS*:
```
'app_version' is version 'v0.1.0' built in 'Release' mode.
Built on: 'Sun 11 Jun 2023 @ 19:09:40 BST' with Odin compiler: 'dev-2023-06'.
Executing on computer 'borrmoons' with 'macOS Unknown (build 22F66, kernel 22.5.0)'.
System information: [ RAM: 8192Gb | CPU: ARM64 | Cores: 8 ].
```Below is an example of `app_version` output when run on a *Raspberry Pi4B*:
```
'app_version' is version 'v0.2.1' built in 'Release' mode.
Built on: 'Sun 02 Jul 2023 @ 11:48:02 BST' with Odin compiler: 'dev-2023-06'.
Executing on computer 'pi4mobi' with ', Linux 5.15.0-1029-raspi'.
System information: [ RAM: 7807Gb | CPU: ARM64 | Cores: 4 ].
```Below is an example of `app_version` output when run on a *Windows 11*:
```
'tripass.exe' is version 'v0.3.1' built in 'Release' mode.
Built on: 'Wed Jul 5 21:07:26 GMTST 2023' with Odin compiler: 'dev-2023-07'.
Executing on computer 'PAVIMOONS' with 'Windows 11 Professional (version: 22H2), build: 22621.1848'.
System information: [ RAM: 32116Gb | CPU: AMD Ryzen 5 4600H with Radeon Graphics | Cores: 12 ]
[ GPU #0: Advanced Micro Devices, Inc. model : 'AMD Radeon(TM) Graphics' RAM '512' ]
[ GPU #1: NVIDIA model : 'NVIDIA GeForce GTX 1050' RAM '3072' ].
```## How to include this package in your Odin project
The inclusion of `app_version` in you own project is easily performed by just adding the code from this repo to you own project. The `app_version` code is a *Odin package* to be used by your main program. The recommended approach is to add `app_version` as a [Git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules). The purpose of *submodules* is to let one project clone another different Git repository into that project, and still keep the commits separate.
This will give the flexibility to allow the *Git* commits for your own project to be separate from those in the `app_version` package. The `app_version` package can still be updated independently as needed with a `git pull` if required. The installation instructions below include the commands to add `app_version` as a *submodule* to you own project.
The approach makes adding *Odin* packages to a existing project very simple and easy to manage. See the *Odin* [packages](https://odin-lang.org/docs/overview/#packages) document for more details.
## Installation
The instructions below assume you are already developing *Odin* programs, and have a working *Odin* compiler installation. Further help with *Odin* can be found here: https://odin-lang.org/
**NOTE:** The process below will add a new directory to your existing *Odin* project called: `app_version`. If you already have an existing package in your own project using that name, you will need to clone this package into a different folder - so as not to overwrite your existing package code.
From a command prompt:
1. Change directory if needed, to ensure you are in the root of your own *Odin* project.
2. Add this *Odin* `app_version` package as a *Git submodule* to your own project: `git submodule add https://github.com/wiremoons/app_version.git app_version`
3. Update the text file named: `VERSION` in the `app_package` directory, or create your own `VERSION` file in the root of your own project. Add your current applications version, for example: `v1.2.5`. Any text of a reasonable size can be used as the version number for your application by adding it to this `VERSION` file on the first line.
4. In you own *Odin* project source code import the `app_version` package: `import "app_version"`
5. To display the version output for your application use the procedure: `app_version.version_show()`
6. When you build or run you own application include the extra `-define:` parameter to ensure the compile date stamp is captured: `odin build . -define:BUILDTS="$(date '+%a %d %b %Y @ %H:%M:%S %Z')"` or `odin run . -define:BUILDTS="$(date '+%a %d %b %Y @ %H:%M:%S %Z')"`. The `date` shell command can be adjusted to suit your own date formatting preferences in required.For additional help, see the `build.sh` and `main.odin` files included in the `app_version` package which can be used as examples of the steps 3-6 described above.
## License
The source code is provided with a *MIT* license, a copy of which is available here: [MIT License](./LICENSE).