add version flag

This commit is contained in:
Ava Apples Affine 2023-06-11 23:48:18 -07:00
parent e802eb480d
commit fb724ccee4
2 changed files with 11 additions and 3 deletions

View file

@ -154,7 +154,6 @@ Note: this section only tracks the state of incomplete TODO items. Having everyt
** DONE Beta tasks ** DONE Beta tasks
(See tag: v0.3.0) (See tag: v0.3.0)
** TODO v1.0 tasks ** TODO v1.0 tasks
- Version flag
- islist type query - islist type query
- Can pass args to relish scripts (via interpreter) - Can pass args to relish scripts (via interpreter)
- Can pass args to relish scripts (via command line) - Can pass args to relish scripts (via command line)

View file

@ -38,8 +38,8 @@ use {
path::{PathBuf, Path}, path::{PathBuf, Path},
}, },
reedline::{ reedline::{
FileBackedHistory, DefaultHinter, DefaultValidator, FileBackedHistory, DefaultHinter, Reedline, Signal,
Reedline, Signal, Prompt, PromptEditMode, PromptHistorySearch, Prompt, PromptEditMode, PromptHistorySearch,
PromptHistorySearchStatus, Completer, Suggestion, Span, PromptHistorySearchStatus, Completer, Suggestion, Span,
KeyModifiers, KeyCode, ReedlineEvent, Keybindings, KeyModifiers, KeyCode, ReedlineEvent, Keybindings,
ColumnarMenu, Emacs, ReedlineMenu, Validator, ValidationResult, ColumnarMenu, Emacs, ReedlineMenu, Validator, ValidationResult,
@ -282,6 +282,15 @@ fn add_menu_keybindings(keybindings: &mut Keybindings) {
fn main() { fn main() {
const HIST_FILE: &str = "/.relish_hist"; const HIST_FILE: &str = "/.relish_hist";
const CONFIG_FILE_DEFAULT: &str = "/.relishrc"; const CONFIG_FILE_DEFAULT: &str = "/.relishrc";
const VERSION: &str = env!("CARGO_PKG_VERSION");
if env::args().count() > 1 &&
env::args()
.collect::<Vec<_>>()
.contains(&"--version".to_string()) {
println!("Relish {}", VERSION);
return;
}
// default config file dirs // default config file dirs
let home_dir = home_dir().unwrap().to_str().unwrap().to_owned(); let home_dir = home_dir().unwrap().to_str().unwrap().to_owned();