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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! # Version and license info APIs
//!
//! This module adds API methods and data items to the Lua global scope
//! to retrieve version information in userscripts.
//!
//! ## Functions
//!
//! All functions in this module are accessible to userscripts in the
//! global scope.
//!
//! | Function | Returns | Description
//! | --- | :---: | --- |
//! | `license()` | nil | Pretty-print the license file. |
//! | `version()` | nil | Pretty-print version info about sscan. |
//!
//! ## Variables
//!
//! All variables in this module are added to a table called `about`,
//! which is accessible by userscripts as a global variable.
//!
//! | Name | Type | Description |
//! | --- | :---: | --- |
//! | `about.app_name` | string | The name of the crate at build time. |
//! | `about.authors` | string | The authors of sscan. |
//! | `about.description` | string | A short description of sscan. |
//! | `about.license` | string | The text of the crate's license. |
//! | `about.license_spdx` | string | The crate's SPDX license identifier. |
//! | `about.repository` | string | The URL to sscan's Github repository. |
//! | `about.version` | string | The build version of sscan. |
//!
//! ## Example
//!
//! ```lua
//! -- Print all version info and print license
//! version()
//! license()
//!
//! -- Access version and authors
//! print(about.version)
//! print(about.authors)
//! ```
//!
// Scope Includes
use *;
/// The name of this crate.
const APP_NAME: &str = env!;
/// The build version.
const VERSION: &str = env!;
/// The crate authors.
const AUTHORS: &str = env!;
/// A short description of the crate.
const DESCRIPTION: &str = env!;
/// Source repository for the crate.
const REPOSITORY: &str = env!;
/// SPDX identifier for the crate's license.
const LICENSE_SPDX: &str = env!;
/// The full text of the crate's license.
const LICENSE: &str = include_str!;
/// Registers the version and license info APIs with Lua.
///
/// This function registers the `about` table containing version and
/// license information, as well as two global convienience functions,
/// `version()` and `license()`, for pretty-printing version info to
/// stdout.
///
/// # Errors
///
/// Any errors returning from this function are Lua errors. If a Lua
/// error occurs, this is probably a bug and should be reported.
///
pub
/// Adds version information variables to a Lua table.
/// Pretty-prints version information to stdout.
/// Prints the license file to stdout.