add upgr config

This commit is contained in:
LordMZTE 2021-10-10 20:33:16 +02:00
parent 248dc50672
commit b86d864a69
2 changed files with 15 additions and 42 deletions

15
.config/upgr/config.toml Normal file
View file

@ -0,0 +1,15 @@
[[steps]]
command = ["nvim", "+:PackerSync", "+:CocUpdate", "+:TSUpdate"]
interactive = true
[[steps]]
command = ["paru", "-Syu"]
unint_alt = ["paru", "-Syu", "--noconfirm"]
interactive = true
[[steps]]
command = ["rustup", "update"]
[[steps]]
command = ["fw", "sync"]

View file

@ -1,42 +0,0 @@
#!/usr/bin/env scriptisto
(*
scriptisto-begin
script_src: sysupdate.ml
build_cmd: dune build sysupdate.exe
target_bin: ./_build/default/sysupdate.exe
files:
- path: dune
content: (executable (name sysupdate) (libraries clap unix))
scriptisto-end
*)
let run cmd =
let splits = String.split_on_char ' ' cmd in
let pipe = Unix.open_process_in ("which " ^ (List.nth splits 0)) in
let status = Unix.close_process_in pipe in
match status with
| Unix.WEXITED 0 ->
let sep_string = String.make (8 + String.length cmd) '=' in
Stdlib.print_endline sep_string;
Stdlib.print_endline ("Running \u{001b}[32m" ^ cmd ^ "\u{001b}[0m");
Stdlib.print_endline sep_string;
let status = Sys.command cmd in
if status != 0 then
raise
(Failure
(String.concat " "
[ "Command"; cmd; "exited with code"; string_of_int status ]))
| _ ->
String.concat " " [ "Command"; cmd; "not found." ] |> Stdlib.print_endline
let () =
Clap.description "Update the system";
let background = Clap.flag ~set_long:"background" ~set_short:'b' false in
Clap.close ();
if not background then
run "nvim '+:PackerSync' '+:CocUpdate' '+:TSUpdate'";
run "paru -Syu --noconfirm";
run "rustup update";
run "fw sync"