1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use proc_macro_hack::proc_macro_hack;


/// Print the build info of your program by setting an environment variable.
///
/// 1. Call `ever` macro at the beginning of your program.
///
/// ```
/// use ever::ever;
///
/// fn main() {
///     ever!();
///
///     println!("Hello, world!");
/// }
/// ```
///
/// 2. Set the environment variable `VERSION` to `1` and run the program. The build info gets printed and the program exits with status `1`.
///
/// ```bash
/// $ VERSION=1 ./your_program
/// your_program 0.1.0 (debug): 
///
///     date:     Fri Mar  1 16:57:20 JST 2019
///     commit:   1cf8aa07dbd2ab4478e14c47a970742040affc3d
///     user:     yushi.omote
///     host:     local
///     builddir: /home/yushi.omote/dev/ever
///     rustc:    rustc 1.34.0-nightly (146aa60f3 2019-02-18)
/// ```
///
/// ## Options
///
/// If you want to change the environment variable name, pass your alternative as an argument.
///
/// ```rust
/// ever!("MY_VERSION");
/// ```
///
/// ```bash
/// $ MY_VERSION=1 ./your_program
/// ```
///
/// ## Note
///
/// The build info is retrieved only when the source file where `ever` macro is placed gets compiled.
///
#[proc_macro_hack]
pub use ever_macro::ever;