Skip to content

Commit

Permalink
bump to 2.14.0
Browse files Browse the repository at this point in the history
add update
  • Loading branch information
vanilla-extracts committed Apr 22, 2024
1 parent 36c2fc0 commit b409f49
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Version 2.13.0 : Update!
You can upgrade the calculator with `mini-calc --update`

# Version 2.12.4 : Fix bug
Fix the bug where the calculated vectors for plotting appeared when plotting

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mini-calc"
version = "2.12.4"
version = "2.13.0"
license = "GPL-3.0-or-later"
description = "A fully-featured minimalistic configurable rust calculator"
homepage = "https://calc.nwa2coco.fr"
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub fn load_color(string: String) -> Color {

pub fn replace_variable(str: String) -> String {
str.replace("%author%", "Charlotte Thomas")
.replace("%version%", "v2.12.4")
.replace("%version%", "v2.13.0")
.to_string()
}

Expand Down
22 changes: 20 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use std::env::{self, Args};
use std::f64::consts::{E, PI};
use std::process::exit;
use std::process::{exit, Command};
use std::str::SplitWhitespace;
use std::sync::Arc;

Expand Down Expand Up @@ -262,7 +262,7 @@ fn handle_config(line: &str, config: Config) -> (String, Option<Config>) {
fn main() {
let mut args: Args = env::args();

let version: String = "v2.12.4".to_string();
let version: String = "v2.13.0".to_string();
if args.len() > 1 || !atty::is(Stream::Stdin) {
let mut a = vec![];

Expand Down Expand Up @@ -293,6 +293,24 @@ fn main() {
exit(0);
}

if arg_final == "-u" || arg_final == "--update" {
if cfg!(target_os = "windows") {
Command::new("cmd")
.args(["/C", "cargo install mini-calc --force"])
.output()
.expect("update failed")
} else {
Command::new("sh")
.arg("-c")
.arg("cargo install mini-calc --force")
.output()
.expect("update failed")
};
println!("mini-calc has been succesfully updated to the latest version");
exit(0);
}


let lexed = lex(arg_final);
let mut parser = init_calc_parser(&lexed);
let parsed = parser.parse();
Expand Down

0 comments on commit b409f49

Please sign in to comment.