egraphs-good / egglog

egraphs + datalog!
https://egraphs-good.github.io/egglog/
MIT License
459 stars 54 forks source link

Display build info when running egglog #427

Closed yihozhang closed 1 month ago

yihozhang commented 2 months ago

This is useful when you install egglog to the system via cargo install --path . and later want to find out what the exact version you installed is.

After this PR:

> cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.16s
     Running `target/debug/egglog`
[INFO ] Welcome to Egglog! (build: 0.2.0_2024-09-25_5bf9dee)

and

> cargo run -- --version
    Finished dev [unoptimized + debuginfo] target(s) in 0.22s
     Running `target/debug/egglog --version`
egglog 0.2.0_2024-09-25_5bf9dee
yihozhang commented 1 month ago

@ezrosent Thanks, I've made the dependency on git optional:

With this PR, if we change git in the command to a non-existent command:

> cargo run
   Compiling egglog v0.2.0 (/Users/yihongzhang/egglog)
    Finished dev [unoptimized + debuginfo] target(s) in 2.77s
     Running `target/debug/egglog`
[INFO ] Welcome to Egglog! (build: 0.2.0_2024-09-26)