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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// License: see LICENSE file at root directory of `master` branch

//! # R1
//!
//! ## Project
//!
//! - Repository: <https://bitbucket.org/haibison/r1>
//! - License: Nice License 1.0.0 _(see LICENSE file at root directory of `master` branch)_
//! - _This project follows [Semantic Versioning 2.0.0]_
//!
//! ## Features
//!
//! This project offers a program via `bin` feature. The program helps run one single instance of any program.
//!
//! For more details, please run the program with `help` command.
//!
//! Currently all features are tested only on Linux. On other Unix systems, the program might or might not work.
//!
//! ## Why?
//!
//! For example, [Qt Creator][w:qt] can run multiple instances. Sometimes you don't want that. Unfortunately there's no setting to tell it to
//! run just one single instance.
//!
//! There are 2 solutions:
//!
//! 1. You can file a feature request (with a picture of your cat in it), and start praying for it to be accepted.
//!
//!     This could take some time. But it's probably not one day. It's not 2 days either.
//!
//!     1 week? Still seems impossible.
//!
//!     ...
//!
//! 2. Or,
//!
//!     You can `r1` it, professionally, just like this:
//!
//!     ```shell
//!     ~> r1 --target=/usr/bin/qtcreator --app-name='Qt Creator'
//!     ```
//!
//!     Tip: you can find its icon here: <https://code.qt.io/cgit/qt-creator/qt-creator.git/>
//!
//! [Semantic Versioning 2.0.0]: https://semver.org/spec/v2.0.0.html
//! [w:qt]: https://www.qt.io

#![warn(missing_docs)]

// ╔═════════════════╗
// ║   IDENTIFIERS   ║
// ╚═════════════════╝

macro_rules! code_name  { () => { "r1" }}
macro_rules! version    { () => { "0.5.0" }}

/// # Crate name
pub const NAME: &str = "R1";

/// # Crate code name
pub const CODE_NAME: &str = code_name!();

/// # ID of this crate
pub const ID: &str = concat!(
    "92367fde-2e86b5fd-1d7b3683-12c3d9d1-85e42107-90fbb262-6dcedd26-29c7d618-",
    "5a713581-44f9add9-b6228f68-5a00c403-9a9c7576-798701e2-5d1671b0-76639e53",
);

/// # Crate version
pub const VERSION: &str = version!();

/// # Crate release date (year/month/day)
pub const RELEASE_DATE: (u16, u8, u8) = (2020, 8, 15);

/// # Tag, which can be used for logging...
pub const TAG: &str = concat!(code_name!(), "::92367fde::", version!());

// ╔════════════════════╗
// ║   IMPLEMENTATION   ║
// ╚════════════════════╝

pub mod version_info;

/// # Result type used in this crate
pub type Result<T> = std::io::Result<T>;

#[test]
fn test_crate_version() {
    assert_eq!(VERSION, env!("CARGO_PKG_VERSION"));
}