diff options
author | Soispha <soispha@vhack.eu> | 2024-02-20 17:21:42 +0100 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2024-02-20 17:21:42 +0100 |
commit | f2bdeaed0bcf97a880fe36cfc8a050d1643120b8 (patch) | |
tree | ba4fe9c3ddf076529701c0e776ffef2104ac23d5 | |
parent | refactor(treewide): Add a `.sh` extension to shell scripts (diff) | |
download | nixos-config-f2bdeaed0bcf97a880fe36cfc8a050d1643120b8.zip |
refactor(treewide): Reformat all files with treefmt
This includes getting all shellscripts to pass shellcheck. To accomplish this, some old scripts were removed
Diffstat (limited to '')
119 files changed, 2866 insertions, 2736 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a8b64f0..514d9ba7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,78 +1,108 @@ # Changelog + All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines. -- - - +______________________________________________________________________ + ## v1.27.4 - 2024-02-12 + #### Bug Fixes + - **(hm/pkgs/scrs/mpc-fav)** Correctly orient the if condition - (81ddabb) - Soispha - **(sys/nixpkgs/pkgs/comments)** Estimate filesize can be > an u32 - (2d383cf) - Soispha -- - - +______________________________________________________________________ ## v1.27.3 - 2024-02-11 + #### Bug Fixes + - **(hm/conf/taskwarrior)** Correctly parse project.nix file - (7e201c8) - Soispha - **(sys/disks)** Differentiate the space limit of '/' an '/tmp' - (5c35f00) - Soispha - **(sys/nixpkgs/pkgs/comments)** Allow unknown comment author - (9ddb7d8) - Soispha + #### Miscellaneous Chores + - **(hm/soispha/conf/taskwarrior/projects)** Update - (59a13b1) - Soispha - **(hm/soispha/conf/taskwarrior/projects)** Update - (4704008) - Soispha -- - - +______________________________________________________________________ ## v1.27.2 - 2024-02-09 + #### Bug Fixes + - **(hm/conf/mail)** Disable himalaya because it changed - (455a1c6) - Soispha - **(sys/nixpkgs/pkgs/yt)** Avoid logging, that mpv can't display chars - (667ec9f) - Soispha - **(sys/nixpkgs/pkgs/yt)** Replace all quotes - (be0b828) - Soispha + #### Build system + - **(treewide)** Update - (2221976) - Soispha -- - - +______________________________________________________________________ ## v1.27.1 - 2024-02-08 + #### Bug Fixes + - **(sys/svcs/printing)** Active cups webinterface - (85a687d) - Soispha -- - - +______________________________________________________________________ ## v1.27.0 - 2024-02-07 + #### Bug Fixes + - **(hm/pkgs/spodi)** Allow more providers - (55cc9d6) - Soispha - **(sys)** Use new module options - (57f5a13) - Soispha - **(sys/nixpkgs/pkgs/comments)** Make `channel_is_verified` optional - (cd344b3) - Soispha - **(sys/svcs/printing)** Use correct printer network address - (765f20b) - Soispha - **(sys/svcs/printing)** Configure Cups to be stateless - (6a32061) - Soispha + #### Build system + - **(.envrc)** Set the CDPATH - (f986c96) - Soispha - **(treewide)** Update - (72ce420) - Soispha + #### Features + - **(hm/pkgs/scrs)** Add `mpc-fav` and `sort_song` - (04e4fe4) - Soispha + #### Refactoring + - **(hm/pkgs/scrs)** Sort the declarations alphabetical - (f2ada3a) - Soispha -- - - +______________________________________________________________________ ## v1.26.3 - 2024-01-30 + #### Bug Fixes + - **(sys/nixpkgs/comments)** Add missing fields to info_json parser - (0bf099b) - Soispha -- - - +______________________________________________________________________ ## v1.26.2 - 2024-01-30 + #### Bug Fixes + - **(treewide)** Fully remove grades - (63b23a0) - Soispha -- - - +______________________________________________________________________ ## v1.26.1 - 2024-01-30 + #### Bug Fixes + - **(hm/pkgs)** Remove `grades` as it no longer compiles - (02ed712) - Soispha -- - - +______________________________________________________________________ ## v1.26.0 - 2024-01-30 + #### Bug Fixes + - **(hm)** Move the session variables to their associated service - (12e3c1a) - Soispha - **(hm/conf/alacritty)** Correct hint regex - (bfaf53d) - Soispha - **(hm/conf/alacritty)** Streamline config - (8b9f77e) - Soispha @@ -114,7 +144,9 @@ All notable changes to this project will be documented in this file. See [conven - **(sys/nixpkgs/ytc)** Check if symlink path exists - (2871dfb) - Soispha - **(sys/svcs/nix)** Improve some default configuration - (2631fac) - Soispha - **(treewide)** Comply with the shell library's new argument names - (98b5114) - Soispha + #### Build system + - **(flake)** Update - (27a28f3) - Soispha - **(treewide)** Update - (df31b93) - Soispha - **(treewide)** Update - (4ad7626) - Soispha @@ -125,9 +157,13 @@ All notable changes to this project will be documented in this file. See [conven - **(treewide)** Update shell library - (86560bc) - Soispha - **(treewide)** Update shell library - (bf2895e) - Soispha - **(treewide)** Update flake and shell library - (95c9314) - Soispha + #### Documentation + - **(hm/pkgs/scrs/neorg/utils)** Fix typo in comment - (8096743) - Soispha + #### Features + - **(flake)** Add `pkgs` subattribute - (3a0db9d) - Soispha - **(hm/conf/less)** Configure the full lesskey file - (4b17d30) - Soispha - **(hm/conf/nvim/plgs/treesitter)** Add custom parser for `yts` - (849cd60) - Soispha @@ -141,13 +177,17 @@ All notable changes to this project will be documented in this file. See [conven - **(sys/nixpkgs/pkgs/yt)** Merge ytc and the rewritten ytc - (089c08a) - Soispha - **(sys/nixpkgs/yt)** Add support for the 'url' command - (b53a8d8) - Soispha - **(sys/nixpkgs/yt/{yt,ytc})** Persist old selection file - (ba3273c) - Soispha + #### Refactoring + - **(hm/pkgs/scrs/specific/neorg/sh)** Split the script into sub-scripts - (94b2cdc) - Soispha -- - - +______________________________________________________________________ ## v1.25.0 - 2024-01-07 + #### Bug Fixes + - **(flake)** Add `cargo` to make the rust language server work - (7aaea01) - Soispha - **(hm/pkgs/scr/specific/ytcc/yts)** Explicitly exit with 0 - (3ecbeb4) - Soispha - **(hm/pkgs/scr/specific/ytcc/yts)** Actually make the subcommands optional - (98fd08f) - Soispha @@ -171,10 +211,14 @@ All notable changes to this project will be documented in this file. See [conven - **(sys/nixpkgs/pkgs/ytc/scr)** Create download dir - (0d63f06) - Soispha - **(sys/nixpkgs/pkgs/ytc/scr/main)** Also delete the file if no id is set - (30808e8) - Soispha - **(sys/nixpkgs/pkgs/ytc/scr/main)** Stop mpv from spamming up stdout - (4e00805) - Soispha + #### Documentation + - **(hm/pkgs/scr/specific/ytcc/yts)** Add a help text - (0b77143) - Soispha - **(sys/nixpkgs/pkgs/ytc)** Slightly improve error output - (82adf42) - Soispha + #### Features + - **(flake)** Add `rustfmt` to the dev environment - (180326f) - Soispha - **(hm/pkgs/scr)** Add support for python based scripts - (9aec145) - Soispha - **(hm/pkgs/scr/specific/ytcc/description)** Add command to display description - (458f532) - Soispha @@ -182,15 +226,21 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/pkgs/scr/ytcc)** Add support for showing comments - (ea09ccf) - Soispha - **(hm/pkgs/scr/ytcc/ytc)** Rewrite in Rust - (d33998b) - Soispha - **(hm/pkgs/scr/ytcc/ytc)** Add support for direct urls - (552f466) - Soispha + #### Miscellaneous Chores + - **(hm/soispha/conf/taskwarrior/projects)** Update - (d84d378) - Soispha + #### Refactoring + - **(hm/pkgs/scr/neorg)** Add subdir for specific script groups - (36f0084) - Soispha -- - - +______________________________________________________________________ ## v1.24.0 - 2024-01-01 + #### Bug Fixes + - **(hm/conf/yambar)** Add some padding - (85a6304) - Soispha - **(hm/conf/yambar/config)** Use correct anchor - (acea986) - Soispha - **(hm/conf/yambar/scripts/sound_volume)** Add higher sleep time - (05ff197) - Soispha @@ -198,18 +248,24 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/conf/ytcc/conf)** Remove duplicated config key - (43eb4d1) - Soispha - **(hm/pkgs/ytc)** Wait for last mpv instance to exit before starting burndown - (0d09df6) - Soispha - **(hm/pkgs/ytc)** Improve cli output - (fae4583) - Soispha + #### Build system + - **(treewide)** Update - (076b147) - Soispha + #### Features + - **(hm/conf/yambar)** Show currently playing song in bar - (f3ca160) - Soispha - **(hm/conf/ytcc)** Init - (4ace681) - Soispha - **(hm/pkgs/ytc)** Init - (2c2458c) - Soispha - **(hm/pkgs/yts)** Init - (b155308) - Soispha -- - - +______________________________________________________________________ ## v1.23.0 - 2023-12-31 + #### Bug Fixes + - **(hm/conf/task/hooks/)** Correctly wrap python hooks to add timewarrior - (3cc639d) - Soispha - **(hm/conf/task/hooks/)** Correctly wrap python hooks to add timewarrior - (1b744b9) - Soispha - **(hm/pkgs)** Remove unneeded array - (9bc0c05) - Soispha @@ -219,25 +275,35 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/pkgs/neorg)** Don't limit too many things on 'tracking' - (ba85d7e) - Soispha - **(hm/pkgs/scr/neorg)** The id argument to 'fstart' is not optional - (97def8c) - Soispha - **(sys/svcs/postgresql)** Only active if not on a laptop - (3d97e34) - Soispha + #### Build system + - **(treewide)** Update - (a9bb6cf) - Soispha + #### Documentation + - **(hm/pkgs/con2pdf)** Add dbg statements - (c35ede7) - Soispha + #### Features + - **(hm/pkgs)** Add ytcc - (371a980) - Soispha - **(hm/pkgs/lock)** Init - (8ea57d8) - Soispha - **(hm/pkgs/neorg)** Add a subcommand to stop the currently active task - (7853b10) - Soispha -- - - +______________________________________________________________________ ## v1.22.1 - 2023-12-29 + #### Bug Fixes + - **(hm/pkgs/hibernate)** Only unset task context + active if existing - (2292808) - Soispha -- - - +______________________________________________________________________ ## v1.22.0 - 2023-12-29 + #### Bug Fixes + - **(hm/conf/)** Use new xdg config module - (02f2218) - Soispha - **(hm/conf/starship)** Also disable git_metrics because of speed - (71dd569) - Soispha - **(hm/conf/starship)** Remove the on in the git branch module - (999be2a) - Soispha @@ -257,23 +323,31 @@ All notable changes to this project will be documented in this file. See [conven - **(sys/svcs/xdg/portals)** Set default download dir - (df27d12) - Soispha - **(sys/svcs/xdg/portals)** Set correct permission of shell script - (f93f3fa) - Soispha - **(sys/svcs/xdg/portals)** Use correct path to lf wrapper - (9d61601) - Soispha + #### Build system + - **(flake)** Update - (90b0a2b) - Soispha - **(flake)** Update - (fc96d6c) - Soispha + #### Features + - **(hm/conf/git)** Update git defaults and add wip command - (a340fd2) - Soispha - **(hm/conf/starship)** Add basic config - (5bd6ec4) - Soispha - **(hm/conf/starship)** Init - (d3ff3d5) - Soispha - **(hm/conf/xdg/url_handler)** Also support opening in zathura - (7fc5e9e) - Soispha - **(hm/pkgs/hibernate)** Init - (e852be1) - Soispha - **(sys/srvc/xdg/termfilechooser)** Reactive - (d562827) - Soispha + #### Refactoring + - **(hm/pkgs/)** Rename all 'src' to 'scr' to improve consistency - (e84c41c) - Soispha -- - - +______________________________________________________________________ ## v1.21.0 - 2023-12-29 + #### Bug Fixes + - **(hm/conf/git)** Use correct path for codeberg ssh url substitution - (5a4815d) - Soispha - **(hm/conf/git)** Revert changing the st alias to the short status - (5fbc81b) - Soispha - **(hm/conf/zsh/sessionVariables)** Add river specific variables - (5013bba) - Soispha @@ -293,11 +367,15 @@ All notable changes to this project will be documented in this file. See [conven - **(sys/svcs/xdg)** Use correct types in termchooser config - (5dfa705) - Soispha - **(sys/svcs/xdg/scripts/lf_wrapper)** Use correct name - (4a246f1) - Soispha - **(sys/svcs/xdg/termfilechooser)** Remove as river does not support it - (49ddb57) - Soispha + #### Build system + - **(flake)** Update - (9725b98) - Soispha - **(treewide)** Update shell library - (b726043) - Soispha - **(treewide)** Update to test xdg-desktop-portal-termfilechooser - (4275064) - Soispha + #### Features + - **(hm/conf/git)** Use correct escaping for '${}' in nix - (d28d93e) - Soispha - **(hm/conf/git)** Use the previous commit's scope when committing - (d3ed407) - Soispha - **(hm/conf/git)** Incorporate elements of other peoples configs - (b166f22) - Soispha @@ -308,101 +386,139 @@ All notable changes to this project will be documented in this file. See [conven - **(sys/options/secret)** Add secret values to evaluation - (612dad9) - Soispha - **(sys/svcs/xdg/termchooser)** Init - (b9d22e2) - Soispha -- - - +______________________________________________________________________ ## v1.20.5 - 2023-12-19 + #### Bug Fixes + - **(hm/pkgs/src/spodi)** Remove setting bitrate - (c950470) - Soispha -- - - +______________________________________________________________________ ## v1.20.4 - 2023-12-19 + #### Bug Fixes + - **(hm/pkgs/src/spodi)** Remove youtube and piped from audio provider list - (49c5787) - Soispha -- - - +______________________________________________________________________ ## v1.20.3 - 2023-12-19 + #### Bug Fixes + - **(hm/pkgs/src/spodi)** Use conventional lyrics again - (ac24887) - Soispha -- - - +______________________________________________________________________ ## v1.20.2 - 2023-12-19 + #### Bug Fixes + - **(hm/pkgs/src/spodi)** Also exclude error-log - (47386bd) - Soispha - **(hm/pkgs/src/spodi)** Remove quotes in the error-log path - (fd6ff36) - Soispha -- - - +______________________________________________________________________ ## v1.20.1 - 2023-12-19 + #### Bug Fixes + - **(hm/pkgs/src/spodi)** Use correct quoting in arguments - (1d745e2) - Soispha -- - - +______________________________________________________________________ ## v1.20.0 - 2023-12-19 + #### Build system + - **(treewide)** Update - (162861d) - Soispha + #### Features + - **(hm/pkgs/src/spodi)** Rework command line arguments - (19ce222) - Soispha + #### Miscellaneous Chores + - **(treewide)** Update shell library - (9da9103) - Soispha -- - - +______________________________________________________________________ ## v1.19.1 - 2023-12-18 + #### Bug Fixes + - **(hm/pkgs/scr/lyrics)** Add missing dependency - (b08b1ff) - Soispha -- - - +______________________________________________________________________ ## v1.19.0 - 2023-12-18 + #### Bug Fixes + - **(hm/pkgs/scr/spodi)** Use the full range of audio providers - (0dcf2ff) - Soispha - **(hm/pkgs/src/lyrics)** Use less instead of cat - (35af94a) - Soispha - **(hm/wms/river/init)** Set env vars from nix config - (abed162) - Soispha + #### Build system + - **(treewide)** Update - (e0cd17c) - Soispha + #### Features + - **(hm/pkgs/src/lyrics)** Init - (ac7b211) - Soispha - **(hm/pkgs/src/mpc-rm)** Provide a command to remove current song - (1b97796) - Soispha -- - - +______________________________________________________________________ ## v1.18.1 - 2023-12-12 + #### Bug Fixes + - **(hm/pkgs/scr/fupdate)** Keep path to allow finding subcommands - (244dd66) - Soispha -- - - +______________________________________________________________________ ## v1.18.0 - 2023-12-12 + #### Bug Fixes + - **(hm/pkgs/scr/neorg)** Use new way to specify completion function - (b0c158a) - Soispha - **(hm/pkgs/scr/spodi)** Reactive, as spotdl builds again - (a377c01) - Soispha - **(hm/pkgs/src/con2pdf)** Prepare shell version update - (0f6523f) - Soispha - **(hm/wms/river/init)** Don't use error handling for setting variables - (1c46c4f) - Soispha - **(hm/wms/river/keys)** Use new screenshot script - (05adc66) - Soispha + #### Build system + - **(treewide)** Update - (6d425ad) - Soispha + #### Features + - **(hm/pkgs/scr/fupdate)** Move fupdate in my main config tree - (4dc8091) - Soispha - **(hm/pkgs/scrs/screenshot)** Add better persistent and temporary script - (9a7988c) - Soispha + #### Miscellaneous Chores + - **(hm/pkgs/scr/llp)** Delete llp, as it's not necessary on Wayland - (3847781) - Soispha - **(hm/pkgs/scrs)** Delete unused and deprecated scripts - (693f5d1) - Soispha - **(treewide)** Update shell library version number - (4a91b6c) - Soispha -- - - +______________________________________________________________________ ## v1.17.1 - 2023-12-10 + #### Bug Fixes + - **(hm/conf/nvim/plgs/harpoon)** Use version locked to the old branch - (78d136c) - Soispha -- - - +______________________________________________________________________ ## v1.17.0 - 2023-12-09 + #### Bug Fixes + - **(flake)** Use self instead of a reimport of itself - (e97702e) - Soispha - **(flake)** Remove the pkgs from the devenv, which are already in nvim - (113499d) - Soispha - **(hm/conf/firefox/package)** Readd policies to firefox - (2f28361) - Soispha @@ -422,7 +538,9 @@ All notable changes to this project will be documented in this file. See [conven - **(sys/impermanence)** Persist the postgresql datebase, if it exists - (b01d2db) - Soispha - **(sys/nixpkgs/plgs-pkgs/override)** Add only actually used plugins - (31f0c39) - Soispha - **(sys/svcs/xdg/portals)** Use new configuration scheme - (b57ee1e) - Soispha + #### Build system + - **(flake)** Update - (bafd46f) - Soispha - **(flake)** Update - (a38b54b) - Soispha - **(flake)** Update - (fe1cd67) - Soispha @@ -431,22 +549,30 @@ All notable changes to this project will be documented in this file. See [conven - **(treewide)** Update - (5f9a797) - Soispha - **(treewide)** Update - (bdf5e03) - Soispha - **(treewide)** Update - (e4454f8) - Soispha + #### Documentation + - **(hm/conf/nvim/plgs/treesitter)** Improve comments - (402925c) - Soispha + #### Features + - **(hm/conf/nvim/plgs/lsp/ltex)** Also activate in `mail` files - (cde288b) - Soispha - **(hm/conf/nvim/plgs/lsp/servers)** Add python language servers - (f440a08) - Soispha - **(hm/pkgs/scrs/con2pdf)** Enable completions - (9d4e1de) - Soispha - **(sys/srvs/postgresql)** Re-enable - (3f2f515) - Soispha - **(treewide)** Specify nvim plugins in my flake - (b6302ae) - Soispha + #### Miscellaneous Chores + - **(hm/soispha/conf/taskwarrior/projects)** Update - (963062f) - Soispha - **(treewide)** Update shell library - (da8f3ab) - Soispha -- - - +______________________________________________________________________ ## v1.16.0 - 2023-10-28 + #### Bug Fixes + - **(flake)** Lock unstable version, until flask-sqlalchemy builds - (0cb2f95) - Soispha - **(flake)** Restore to last working git revision because of harpoon - (6a1cc3b) - Soispha - **(flake)** Pin nixpkgs on a rev because nvim update brakes some plugins - (b8f170d) - Soispha @@ -501,7 +627,9 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/soispha/nvim/plgs/nvim-cmp)** Disable diagraphs - (15e05fe) - Soispha - **(hm/wms/river/res/keys)** Set up correct mappings for all hosts - (948e025) - Soispha - **(sys/font)** Add required font for rofi theme - (1968389) - Soispha + #### Build system + - **(flake)** Update - (87d3861) - Soispha - **(flake)** Update (+ shell_library) - (1378514) - Soispha - **(flake)** Add a dummy follow for 'my_flake' to prevent a cyclic dependency - (faf3d03) - Soispha @@ -517,10 +645,14 @@ All notable changes to this project will be documented in this file. See [conven - **(treewide)** Update (shell library) - (338e400) - Soispha - **(treewide)** Update - (6aa67e4) - Soispha - **(treewide)** Update - (26bcc19) - Soispha + #### Documentation + - **(notes/git_crypt)** Explain what to do, when git-crypt fails - (876bcf7) - Soispha - **(notes/names)** Add a comment about the naming scheme for new hosts - (3f5f718) - Soispha + #### Features + - **(hm)** Expose the video_pause binary - (1500f45) - Soispha - **(hm/conf/firefox)** Use the policy.json file for configs - (27a254a) - Soispha - **(hm/conf/firefox/extensions)** Switch to my libredirect fork - (a780ce0) - Soispha @@ -540,7 +672,9 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/soispha/git)** Add 'cm' (commit) alias - (0dcbdc9) - Soispha - **(hm/wms/river/keys)** Use rofi in the mappings - (3134d5e) - Soispha - **(sys/svcs/nix)** Add my flake to the flake registry - (db1f4d6) - Soispha + #### Miscellaneous Chores + - **(hm/conf/taskwarrior/projects)** Update - (b52543b) - Soispha - **(hm/conf/taskwarrior/projects)** Update - (d1be07b) - Soispha - **(hm/conf/taskwarrior/projects)** Update - (02be0c1) - Soispha @@ -558,16 +692,22 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/soispha/conf/taskwarrior/projects)** Update - (f0ed650) - Soispha - **(hm/soispha/conf/taskwarrior/projects)** Update - (f02f1a7) - Soispha - **(hm/soispha/conf/taskwarrior/projects)** Update - (131ac87) - Soispha + #### Refactoring + - **(hm/conf/taskwarrior/projects)** Store the parsed projects in a attr - (4f0dec5) - Soispha + #### Style + - **(hm/conf/firefox)** Format with alejandra - (629325d) - Soispha - **(hm/conf/taskwarrior)** Format - (edc46b9) - Soispha -- - - +______________________________________________________________________ ## v1.15.0 - 2023-10-08 + #### Bug Fixes + - **(flake/packages)** Remove gpg-iso as it's not used - (8d33dd8) - Soispha - **(flake/packages)** Apply eta-reduction - (d2f4920) - Soispha - **(hm/conf/lf/keybinds)** Add keymap to go to nixos-server config - (c7963f3) - Soispha @@ -592,25 +732,35 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/conf/timewarrior)** Use correct file creation syntax - (680150d) - Soispha - **(hm/conf/timewarrior)** Actually import timewarrior - (12a0eb1) - Soispha - **(sys/secrets)** Rename 'name' to 'hostName' - (0cb2eab) - Soispha + #### Build system + - **(flake)** Update - (5044f24) - Soispha + #### Features + - **(hm/conf/taskwarrior)** Add taskserver based syncing - (cacaeac) - Soispha - **(hm/conf/taskwarrior)** Add hook scripts - (3a9a44d) - Soispha - **(hm/conf/taskwarrior)** Add first config for neorg ⇄ taskwarrior interop - (4d8f53f) - Soispha - **(hm/conf/taskwarrior/projects)** Add support for nested projects - (6f38b01) - Soispha - **(hm/conf/timewarrior)** Init - (563938d) - Soispha - **(hm/pkgs/scrs/neorg)** Add support for opening current task context - (7d56f48) - Soispha + #### Miscellaneous Chores + - **(hm/conf/taskwarrior/projects)** Update - (bf16973) - Soispha - **(revert)** "fix(hm/conf/taskwarrior): Add 'total_active_time' to next report" - (e55fdd9) - Soispha + #### Style + - **(hm/pkgs/scripts)** Reorder alphabetically - (9e3315c) - Soispha -- - - +______________________________________________________________________ ## v1.14.0 - 2023-10-01 + #### Bug Fixes + - **(hm/conf/firefox/prefs)** Use defined download dir - (b973cf1) - Soispha - **(hm/conf/firefox/search)** Only update icons every two days - (dedba1c) - Soispha - **(hm/conf/firefox/search)** Add home-manager search as search engine - (cd5d35c) - Soispha @@ -620,62 +770,88 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/conf/taskwarrior)** Specify news.version persistently - (9b74754) - Soispha - **(hm/conf/zsh)** Display current task on shell init - (34147c6) - Soispha - **(hm/pkgs/scrs/wrappers/yti)** Rework to today's standards - (af1dc59) - Soispha + #### Build system + - **(flake)** Update - (1516351) - Soispha - **(flake)** Update - (0252379) - Soispha - **(treewide)** Update - (ee7e01e) - Soispha + #### Features + - **(hm/conf/firefox/search)** Add tokio-rs docs to search engines - (6e14439) - Soispha - **(hm/conf/hyfetch)** Init - (77f8641) - Soispha - **(hm/conf/taskwarrior)** Init - (c40c744) - Soispha -- - - +______________________________________________________________________ ## v1.13.0 - 2023-09-17 + #### Bug Fixes + - **(hm/conf/firefox/scripts/extract_cookies)** Init - (b2dcfe4) - Soispha - **(hm/conf/firefox/scripts/unzip_mozl4)** Change to correct shebang - (c518d2e) - Soispha - **(hm/conf/nvim/plgs/nvim-lint)** Remove shellcheck, as bash ls exits - (b5d2d70) - Soispha - **(hosts/tiamat)** Enable adb bridge for soispha - (fb3ff58) - Soispha + #### Build system + - **(flake)** Update - (d450bd2) - Soispha - **(treewide)** Update - (4665b34) - Soispha + #### Features + - **(sys/srvs/adb)** Init - (7c90c15) - Soispha + #### Style + - **(sys/srvs/adb)** Format with alejandra - (01c286e) - Soispha -- - - +______________________________________________________________________ ## v1.12.0 - 2023-09-16 + #### Bug Fixes + - **(hm/pkgs/scritps/neorg)** Add ability to access workspace directly - (c7ac896) - Soispha - **(treewide)** Update to new `tmp` function interface - (8fed302) - Soispha - **(treewide)** Update shell library - (21c0fae) - Soispha - **(treewide)** Update to the newest shell lib version - (9ba4a13) - Soispha - **(treewide)** Purge `snap-sync` in favour of `snap-sync-forked` - (cb13265) - Soispha - **(treewide)** Provide `snap-synced-forked` as overlay and thus as pkg - (e573fc9) - Soispha + #### Build system + - **(flake)** Update - (24afaa8) - Soispha - **(flake)** Update - (4b353ca) - Soispha + #### Features + - **(hm/conf/zsh/insults)** Init - (ca4bd2f) - Soispha -- - - +______________________________________________________________________ ## v1.11.0 - 2023-09-05 + #### Bug Fixes + - **(hm/conf/gpg/keys/key_4)** Add missing comments - (2432eba) - Soispha - **(hm/conf/zsh)** Ensure that the sourced shell library also gets updated - (441249a) - Soispha + #### Build system + - **(flake)** Update - (06b286d) - Soispha + #### Features + - **(hm/conf/gpg/keys)** Add gpg key - (f1a4ac9) - Soispha -- - - +______________________________________________________________________ ## v1.10.0 - 2023-09-05 + #### Bug Fixes + - **(hm/conf/lf/keybinds)** Fix missing settings in the cd commands - (63f844e) - Soispha - **(hm/conf/lf/keymappings)** Add command to go to nixos-config - (1a115c3) - Soispha - **(hm/conf/lf/keymaps)** Run the rename command in the console - (b15b661) - Soispha @@ -691,27 +867,37 @@ All notable changes to this project will be documented in this file. See [conven - **(sys/srvs/xdg)** Add gtk desktop portal - (851a4cf) - Soispha - **(sys/waydroid)** Disable waydroid again, as it breaks fuse mounts - (7e12b54) - Soispha - **(treewide)** Update to new shell library version - (f68f558) - Soispha + #### Build system + - **(treewide)** Update - (bcdba47) - Soispha + #### Documentation + - **(sys/disks/hibernate)** Remove resolved TODO comment - (d807fb1) - Soispha + #### Features + - **(flake/packages)** Pass through `shell_library_update` packages - (c0ac01f) - Soispha - **(hm/pkgs/scripts/neorg)** Init - (c60fbe6) - Soispha - **(sys/locale)** Add modified dvorak keymap - (a97a8df) - Soispha - **(sys/locale)** Add a keymap with special char support - (fe00eef) - Soispha - **(sys/waydroid)** Init - (fce35d5) - Soispha -- - - +______________________________________________________________________ ## v1.9.1 - 2023-08-30 + #### Bug Fixes + - **(hm/conf/nvim/mappings)** Switch `gg` to `uu` - (9bbbae9) - Soispha -- - - +______________________________________________________________________ ## v1.9.0 - 2023-08-30 + #### Bug Fixes + - **(.gitattributes)** Correct encrypted paths - (96d0cdd) - Soispha - **(bootstrap)** Specify experimental-features before arguments to disko - (d58fa72) - Soispha - **(bootstrap)** Add udevadm as a dependency - (a32a937) - Soispha @@ -879,7 +1065,9 @@ All notable changes to this project will be documented in this file. See [conven - **(treewide)** Use tlp and thermald for power saving - (ca0ca5e) - Soispha - **(treewide)** Add `git-crypt` - (ae848c7) - Soispha - Temporarily disable lanzaboot to set tempfs size - (64dfa6c) - Soispha + #### Build system + - **(flake)** Update - (bae1f58) - Soispha - **(flake)** Update - (410eb8d) - Soispha - **(flake)** Update - (deb8151) - Soispha @@ -898,7 +1086,9 @@ All notable changes to this project will be documented in this file. See [conven - **(treewide)** Update - (feb9db9) - Soispha - **(treewide)** Update - (1224925) - Soispha - **(update.sh)** Use correct path to update script - (4e425ab) - Soispha + #### Documentation + - **(hm/conf/lf/commads/trash)** Add fixme about the implementation - (c7c1a63) - Soispha - **(hm/packages)** Improve comments - (697e1e4) - Soispha - **(system/disks)** Remove checked TODO comments - (411eb38) - Soispha @@ -907,7 +1097,9 @@ All notable changes to this project will be documented in this file. See [conven - **(todo)** Add link to work/live separation - (3f82086) - Soispha - **(treewide)** Add a colon after "FIXME"s - (8249833) - Soispha - **(treewide)** Add a colon after every "TODO" - (a01a3d4) - Soispha + #### Features + - **(.editorconfig)** Add lua config - (65b9e40) - Soispha - **(.gitattributes)** Add git-crypt encrypted file - (0699ff3) - Soispha - **(disko)** Squash Commit - (5eb25c3) - Soispha @@ -943,7 +1135,7 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/conf/neovim/plugins/telescope/extensions/symbols)** Init - (8a6c60c) - Soispha - **(hm/conf/neovim/plugins/todo-comments)** Init - (d22d6dc) - Soispha - **(hm/conf/neovim/plugins/which-key)** Init - (0ad6ed5) - Soispha -- **(hm/conf/nvim)** Add basic nix config [REBASE TARGET] - (be1cc38) - Soispha +- **(hm/conf/nvim)** Add basic nix config \[REBASE TARGET\] - (be1cc38) - Soispha - **(hm/conf/nvim/autocmds)** Add mkdir autocmd - (d341d4d) - Soispha - **(hm/conf/nvim/mappings)** Add mapping to go to file (<enter>) - (af39c05) - Soispha - **(hm/conf/nvim/maps)** Add keymaps for tab movement - (c55ee1a) - Soispha @@ -969,11 +1161,17 @@ All notable changes to this project will be documented in this file. See [conven - **(system/services/postgresql)** Init - (8eb9404) - Soispha - **(treewide)** Import nixVim - (f4dcf65) - Soispha - **(treewide)** Add enable options for secrets and impermanence - (3f5e7b9) - Soispha + #### Miscellaneous Chores + - **(hm/conf/lf/commads)** Add initial draft of a reflinking cp in lf - (6a77c31) - Soispha + #### Performance Improvements + - **(flake/packages/nvim)** Use list merge feature of the merge function - (be1f02c) - Soispha + #### Refactoring + - **(bootstrap)** Use disko - (c3d2c88) - Soispha - **(hm/conf/alacritty)** Split the configuration in separate files - (6e439e3) - Soispha - **(hm/conf/neovim/plugins/luasnip/snippets)** Remove unnused ones - (b6aac33) - Soispha @@ -981,21 +1179,27 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/conf/zsh)** Use new syntaxHighlight option - (e7a6107) - Soispha - **(treewide)** Abbreviate path names - (3f600ab) - Soispha - **(treewide)** Move module configuration in separate files - (0a608bd) - Soispha + #### Revert + - "Fix(hm/conf/alacritty/color): Don't import this" - (5a52e70) - Soispha - "Fix(hm/conf/lf): Update icons to nerdfonts v3" - (d607d17) - Soispha - "Fix: Temporarily disable lanzaboot to set tempfs size" - (dd70869) - Soispha + #### Style + - **(hm/conf/neovim)** Format - (3d37c38) - Soispha - **(system/impermanece)** Remove unused arguments - (ed9c2f9) - Soispha - **(treewide)** Format all lua-files makes lua ➛ nix easier - (4c743a2) - Soispha - **(treewide)** Remove some unused imports - (92a9e22) - Soispha - **(treewide)** Switch to editorconfig - (3262a78) - Soispha -- - - +______________________________________________________________________ ## v1.8.3 - 2023-06-25 + #### Bug Fixes + - **(hm/conf/git)** Add info about gpg sigs to git log - (9efd974) - Soispha - **(hm/conf/gpg)** Disable agent as it does not work - (63fccc6) - Soispha - **(hm/conf/neomutt)** Remap l to something usefull - (e15d12a) - Soispha @@ -1003,17 +1207,21 @@ All notable changes to this project will be documented in this file. See [conven - **(system/libvirtd)** Allow usb redirection with spice - (9a24cce) - Soispha - **(system/services/nix)** Use nixStable as unstable is broken right now - (669f7b4) - Soispha - **(system/services/serverphone)** Add home dir - (705f6f6) - Soispha + #### Build system + - **(flake)** Update - (354f8bf) - Soispha - **(flake)** Update - (4ea8f77) - Soispha - **(flake)** Update - (ab576ba) - Soispha - **(flake)** Update - (98c017d) - Soispha - **(flake)** Update - (71f0671) - Soispha -- - - +______________________________________________________________________ ## v1.8.2 - 2023-06-16 + #### Bug Fixes + - **(hm/conf/gpg)** Enable pinentry - (02635f7) - Soispha - **(hm/conf/gpg/agent)** Reduce verbosity - (a014d9c) - Soispha - **(hm/conf/neomutt)** Use vim-like keybindings - (032875e) - Soispha @@ -1021,59 +1229,85 @@ All notable changes to this project will be documented in this file. See [conven - **(system/services/serverphone)** Correct line breaks - (de85606) - Soispha - **(system/services/serverphone)** Assure that all paths are available - (d0d1e2e) - Soispha - **(system/services/serverphone)** Make symlink relative - (e68305e) - Soispha + #### Build system + - **(flake)** Update - (b743f40) - Soispha - **(treewide)** Update - (ec0a3df) - Soispha -- - - +______________________________________________________________________ ## v1.8.1 - 2023-06-06 + #### Bug Fixes + - **(secrets)** Rename to find file - (fc9652b) - Soispha -- - - +______________________________________________________________________ ## v1.8.0 - 2023-06-06 + #### Bug Fixes + - **(flake)** Return to unstable - (ea9d360) - Soispha - **(hm/conf/swaylock)** Switch to different wp - (3e1d6d9) - Soispha - **(system/services/serverphone)** Fully add - (3f7852d) - Soispha - **(treewide)** Update the shell library version - (39229a1) - Soispha + #### Build system + - **(flake)** Update - (926f0e4) - Soispha + #### Features + - **(hm/conf/firefox/bookmarks)** Add nix lib and nixpkgs man - (13e1056) - Soispha - **(system/services/serverphone)** Add - (a2a5ee2) - Soispha + #### Miscellaneous Chores + - **(version)** v1.7.1 - (d9796a0) - Soispha + #### Refactoring + - **(secrets/nheko)** Separate in directory - (f228c79) - Soispha -- - - +______________________________________________________________________ ## v1.7.1 - 2023-05-29 + #### Bug Fixes + - **(treewide)** Update the shell library version - (f463519) - Soispha -- - - +______________________________________________________________________ ## v1.7.0 - 2023-05-29 + #### Bug Fixes + - **(hm/conf/lf/keybinds)** Update - (f94e50a) - Soispha - **(hm/conf/zsh)** Quote string - (d4ff072) - Soispha - **(hm/conf/zsh)** Also add a version for the shell library - (180f86c) - Soispha - **(hm/pkgs/scrs/ll)** Don't use the tempdir provided by lib - (9cc1b8c) - Soispha + #### Build system + - **(flake)** Update - (ce9a7aa) - Soispha + #### Features + - **(hm/conf/lf/cmds)** Add a way to create temp scripts - (7d320b8) - Soispha + #### Style + - **(hm/conf/zsh)** Indent comment - (95e7be9) - Soispha -- - - +______________________________________________________________________ ## v1.6.0 - 2023-05-28 + #### Bug Fixes + - **(bootstrap)** Quote scripts - (1f79cb3) - Soispha - **(flake)** Add 'flake_version_update' for following - (6ac6e61) - Soispha - **(hm/conf/lf/cmds)** Rework some of them - (e5af81a) - Soispha @@ -1081,46 +1315,66 @@ All notable changes to this project will be documented in this file. See [conven - **(hm/conf/yambar/scripts)** Quote scripts - (cb33626) - Soispha - **(hm/pkgs/scrs)** Rework some of them - (df2e590) - Soispha - **(treewide)** Update to new shell library version - (12665e7) - Soispha + #### Build system + - **(cog)** Remove useless echo - (ed45d41) - Soispha - **(flake)** Update - (44a02de) - Soispha - **(flake)** Update - (2727782) - Soispha + #### Documentation + - **(hm/wms/river/init)** Add a hint to simplify script - (99f9b6f) - Soispha + #### Features + - **(hm/pkgs/scrs/update-sys)** Add a way to specify to mode - (96d2ce9) - Soispha -- - - +______________________________________________________________________ ## v1.5.2 - 2023-05-27 + #### Bug Fixes + - **(flake)** Switch to Soisphas templates - (936a2b8) - Soispha - **(hm/conf/firefox/prefs)** Readd the download dir setting - (df64a1d) - Soispha - **(hosts/marduk)** Use compatible kernel for zfs - (b634108) - Soispha + #### Build system + - **(flake)** Update - (4b32094) - Soispha - **(update.sh)** Make script somewhat more path indifferent - (f513441) - Soispha -- - - +______________________________________________________________________ ## v1.5.1 - 2023-05-26 + #### Bug Fixes + - **(flake)** Stay on 23.05 until all dependencies have been updated - (8428847) - Soispha - **(hm/conf/firefox/bookmarks)** Remove url garbage in DeepL - (fc9cd23) - Soispha - **(hm/conf/firefox/prefs)** Open new tabs next to the current one - (d595360) - Soispha - **(hm/conf/firefox/prefs)** Disable auto scroll - (0945701) - Soispha - **(host/marduk)** Override the iso name, to avoid a merge conflict - (b33a863) - Soispha + #### Build system + - **(treewide)** Update - (7b21a46) - Soispha + #### Documentation + - **(todo)** Update - (94efa18) - Soispha + #### Refactoring + - **(hm/conf/firefox/prefs)** Add only the dynamic ones in nix - (16d8862) - Soispha -- - - +______________________________________________________________________ ## v1.5.0 - 2023-05-21 + #### Bug Fixes + - **(hm/conf/cups)** Delete cups folder, as it's useless - (75cb791) - Soispha - **(hm/conf/gpg/keys)** Add soispha@vhack.eu - (b4dabf8) - Soispha - **(hm/pkgs/scr/con2pdf)** Don't try batch mode when using the Flatbed - (6aea234) - Soispha @@ -1132,23 +1386,33 @@ All notable changes to this project will be documented in this file. See [conven - **(system)** Add configs for networkmanager only if it's enabled - (4d1a37c) - Soispha - **(system/libvirt)** Remove omvf for aarch, as it's not used - (8e6d126) - Soispha - **(system/users)** Remove plugdev group, as it's deprecated - (3188a97) - Soispha + #### Build system + - **(flake)** Update - (52d2b73) - Soispha - **(flake)** Update - (c75c2cb) - Soispha - **(flake)** Update deps - (443a925) - Soispha - **(fupdate)** Add generate_extensions to the inputs to avoid gc - (725047d) - Soispha + #### Features + - **(hm/conf/gpg)** Add gpg key of sils@sils.li - (9d9e942) - Soispha + #### Refactoring + - **(system/services/printing)** Split printing and scanning - (c025d9c) - Soispha - **(system/users)** Add the groups in the file, giving context - (c84419c) - Soispha + #### Style + - **(treewide)** Format - (3ae3782) - Soispha -- - - +______________________________________________________________________ ## v1.4.0 - 2023-05-18 + #### Bug Fixes + - **(hm/conf/gpg)** Use nixos to write the agent script - (00afa44) - Soispha - **(hm/pkgs/scr/con2pdf)** Rewrite to update to nix - (4bab53c) - Soispha - **(system)** Truly disable all the NixOS default bloat - (7997ee7) - Soispha @@ -1157,20 +1421,30 @@ All notable changes to this project will be documented in this file. See [conven - **(system/services/printing)** Only start cups as needed - (37dcd30) - Soispha - **(system/services/snapper)** Use new option layout - (3052bd6) - Soispha - **(sytem/services/printing)** Make scanners work - (562e3c6) - Soispha + #### Build system + - **(flake)** Update - (a1d4200) - Soispha - **(flake)** Update - (719d9b9) - Soispha + #### Documentation + - **(system/users)** Remove unneeded comment - (5786bf0) - Soispha + #### Features + - **(hm/conf/gpg)** Enforce key entry through nixos config - (fa9a810) - Soispha + #### Miscellaneous Chores + - **(version)** v1.3.0 - (cb4c41d) - Soispha -- - - +______________________________________________________________________ ## v1.3.0 - 2023-05-17 + #### Bug Fixes + - **(hm/conf/gpg)** Use nixos to write the agent script - (8ad4d4b) - Soispha - **(system)** Truly disable all the nixos default bloat - (c034509) - Soispha - **(system/boot)** Remove deprecated option - (b7000a2) - Soispha @@ -1178,49 +1452,73 @@ All notable changes to this project will be documented in this file. See [conven - **(system/services/printing)** Only start cups as needed - (01941c4) - Soispha - **(system/services/snapper)** Use new option layout - (b952dd1) - Soispha - **(sytem/services/printing)** Make scanners work - (874e187) - Soispha + #### Build system + - **(flake)** Update - (d389a40) - Soispha + #### Documentation + - **(system/users)** Remove unneeded comment - (27340fd) - Soispha + #### Features + - **(hm/conf/gpg)** Enforce key entry through nixos config - (0a2afc6) - Soispha -- - - +______________________________________________________________________ ## v1.2.0 - 2023-05-16 + #### Bug Fixes + - **(hm/conf/swaylock)** Use correct mapping from path to string - (df4b667) - Soispha - **(hm/pkgs)** Remove unused ones - (340566f) - Soispha - **(hosts/tiamat)** Remove outdated network config - (a2fa552) - Soispha - **(system/network)** Use correct names for group and user - (fb98f1b) - Soispha - **(system/network)** Set networks for netdev devices - (6f12ec1) - Soispha + #### Build system + - **(flake)** Update - (d7ad150) - Soispha - **(flake)** Update deps - (e8648b5) - Soispha + #### Documentation + - **(todo)** Update - (b170278) - Soispha + #### Features + - **(system/network)** Add a tap device and bridges - (ec02b31) - Soispha -- - - +______________________________________________________________________ ## v1.1.1 - 2023-05-13 + #### Bug Fixes + - **(hm/conf/lf)** Add missing elements in Path to /run dir - (069a93c) - Soispha -- - - +______________________________________________________________________ ## v1.1.0 - 2023-05-13 + #### Bug Fixes + - **(hm/conf/zsh)** Readd the default qemu address - (e246847) - Soispha + #### Build system + - **(flake)** Update - (0901fc2) - Soispha + #### Features + - **(hm/conf/git)** Add further aliases - (3d5f2c2) - Soispha - **(hm/conf/git)** Reword git commit template - (b504cf8) - Soispha + #### Refactoring + - **(hm/conf/git)** Remove useless variable assignment - (edd7085) - Soispha -- - - +______________________________________________________________________ -Changelog generated by [cocogitto](https://github.com/cocogitto/cocogitto). \ No newline at end of file +Changelog generated by [cocogitto](https://github.com/cocogitto/cocogitto). diff --git a/bootstrap/01_activate.sh b/bootstrap/01_activate.sh index 82e45761..ccfdd644 100755 --- a/bootstrap/01_activate.sh +++ b/bootstrap/01_activate.sh @@ -10,10 +10,10 @@ nix run github:nix-community/disko --experimental-features 'nix-command flakes' msg "Finished mounting" case "$ACTIVATE_TO_SETUP" in - "yes") - nix run "git+https://codeberg.org/soispha/nixos-config#setup" --experimental-features 'nix-command flakes' - ;; - *) ;; +"yes") + nix run "git+https://codeberg.org/soispha/nixos-config#setup" --experimental-features 'nix-command flakes' + ;; +*) ;; esac # vim: ft=sh diff --git a/bootstrap/01_install.sh b/bootstrap/01_install.sh index e4581b6d..bf49af60 100755 --- a/bootstrap/01_install.sh +++ b/bootstrap/01_install.sh @@ -11,13 +11,14 @@ warning "This information needs to be entered in the host configuration BEFORE r info_applied=false while [ "$info_applied" = false ]; do readp "Have you updated your chosen host with the choose disk id? [N/y]: " result + # shellcheck disable=SC2154 case $result in - [Yy]) - info_applied=true - ;; - *) - warning "You won't be able to boot, if you don't update it!" - ;; + [Yy]) + info_applied=true + ;; + *) + warning "You won't be able to boot, if you don't update it!" + ;; esac done @@ -38,44 +39,44 @@ info_applied=false while [ "$info_applied" = false ]; do readp "Have you updated your chosen host with this information? [N/y]: " result case $result in - [Yy]) - info_applied=true - ;; - *) - warning "You won't be able to boot, if you don't update it!" - ;; + [Yy]) + info_applied=true + ;; + *) + warning "You won't be able to boot, if you don't update it!" + ;; esac done msg "Checking for incompatibilities..." ssd_or_hdd="$(cat /sys/block/"$(basename "$(readlink -f "/dev/disk/by-id/$NIX_DISK")" | tr -d '\n')"/queue/rotational)" case "$ssd_or_hdd" in - 0) - msg2 "You seem to use a ssd." - trim_support=$(lsblk --bytes --json --discard | jq --arg name "$(basename "$(readlink -f "/dev/disk/by-id/$NIX_DISK")" | tr -d '\n')" '.blockdevices | .[] | select(.name == $name) | (.["disc-gran"] + .["disc-max"]) != 0') - case $trim_support in - "true") - msg2 "Yay, your ssd supports trim, go on and activate it" - ;; - "false") - msg2 "Nay, your ssd doesn't support trim" - ;; - *) - warning "Your ssd doesn't seem to exists, if this bothers you please open an issue." - ;; - esac +0) + msg2 "You seem to use a ssd." + trim_support=$(lsblk --bytes --json --discard | jq --arg name "$(basename "$(readlink -f "/dev/disk/by-id/$NIX_DISK")" | tr -d '\n')" '.blockdevices | .[] | select(.name == $name) | (.["disc-gran"] + .["disc-max"]) != 0') + case $trim_support in + "true") + msg2 "Yay, your ssd supports trim, go on and activate it" ;; - 1) - msg2 "You seem to use a hdd there is nothing you have to do" + "false") + msg2 "Nay, your ssd doesn't support trim" ;; *) - warning "There is no indicator, which shows, which drive your are using.\n This means, that you have to check yourself, which optimizations you should activate." + warning "Your ssd doesn't seem to exists, if this bothers you please open an issue." ;; + esac + ;; +1) + msg2 "You seem to use a hdd there is nothing you have to do" + ;; +*) + warning "There is no indicator, which shows, which drive your are using.\n This means, that you have to check yourself, which optimizations you should activate." + ;; esac case "$INSTALL_TO_SETUP" in - "yes") - nix run "git+https://codeberg.org/soispha/nixos-config#setup" --experimental-features 'nix-command flakes' - ;; - *) ;; +"yes") + nix run "git+https://codeberg.org/soispha/nixos-config#setup" --experimental-features 'nix-command flakes' + ;; +*) ;; esac diff --git a/bootstrap/02_setup.sh b/bootstrap/02_setup.sh index 44368f69..7b539c52 100755 --- a/bootstrap/02_setup.sh +++ b/bootstrap/02_setup.sh @@ -16,8 +16,8 @@ chown 1000:100 --recursive /mnt/srv/home chmod 700 /mnt/srv/home case "$SETUP_TO_CONFIG_SETUP" in - "yes") - nix run "git+https://codeberg.org/soispha/nixos-config#config_setup" --experimental-features 'nix-command flakes' - ;; - *) ;; +"yes") + nix run "git+https://codeberg.org/soispha/nixos-config#config_setup" --experimental-features 'nix-command flakes' + ;; +*) ;; esac diff --git a/bootstrap/99_ensure_config_variables.sh b/bootstrap/99_ensure_config_variables.sh index ce8ffa0f..ba7d0a58 100755 --- a/bootstrap/99_ensure_config_variables.sh +++ b/bootstrap/99_ensure_config_variables.sh @@ -7,20 +7,20 @@ if ! [ "$NIX_ENVIRONMENT_VARIABLES_SET" ]; then if ! [ "$NIX_HOST" ]; then msg "Select a host:" _hosts=$(mktmp) - curl https://codeberg.org/soispha/nixos-config/raw/branch/prime/flake/nixosConfigurations/default.nix 2> /dev/null | awk -F '"' '/hosts = /{for (i=2;i<NF;i+=2) {print $i}}' > "$_hosts" + curl https://codeberg.org/soispha/nixos-config/raw/branch/prime/flake/nixosConfigurations/default.nix 2>/dev/null | awk -F '"' '/hosts = /{for (i=2;i<NF;i+=2) {print $i}}' >"$_hosts" - while ! grep "$host" "$_hosts" > /dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; do + while ! grep "$host" "$_hosts" >/dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; do i=1 while read -r host_read; do printf "%4s) %s \n" "$i" "$host_read" i=$((i + 1)) - done < "$_hosts" + done <"$_hosts" printf "%4s) Exit\n" "q" readp "Enter a option: " host [ "$host" = "q" ] && exit 1 host=$(awk -v i="$host" '{if (NR==i) {print $0}}' "$_hosts") - if ! grep "$host" "$_hosts" > /dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; then + if ! grep "$host" "$_hosts" >/dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; then warning "No host selected. Select a host to continue.\n" fi done @@ -29,16 +29,16 @@ if ! [ "$NIX_ENVIRONMENT_VARIABLES_SET" ]; then fi if ! [ "$NIX_DISK" ] && [ "$INSTALL" ]; then available_disks="$(mktmp)" - lsblk -J | jq '.[] | map(.name) | [foreach .[] as $item ({item: null, index: -1}; {$item, index: (.index + 1)})]' > "$available_disks" + lsblk -J | jq '.[] | map(.name) | [foreach .[] as $item ({item: null, index: -1}; {$item, index: (.index + 1)})]' >"$available_disks" [ "$(jq '.[]' "$available_disks" | wc -l)" -eq 0 ] && die "No disks found" msg "Select a disk to format:" i=9999 # nobody will have so many disks attached - while ! jq -e --argjson i "$i" '.[$i]' "$available_disks" > /dev/null 2>&1; do + while ! jq -e --argjson i "$i" '.[$i]' "$available_disks" >/dev/null 2>&1; do for _disk in $(jq -c '.[]' "$available_disks"); do - printf "%4s) %s \n" "$(echo "$_disk" | jq '.index')" "$(echo "$_disk" | jq '.item' | tr -d "\"")" + printf "%4s) %s \n" "$(echo "$_disk" | jq '.index')" "$(echo "$_disk" | jq '.item' | tr -d '"')" done printf "%4s) Exit\n" "q" readp "Enter a option: " _disk @@ -48,9 +48,9 @@ if ! [ "$NIX_ENVIRONMENT_VARIABLES_SET" ]; then else i="$_disk" fi - if jq -e --argjson i "$i" 'nth($i)' "$available_disks" > /dev/null 2>&1; then + if jq -e --argjson i "$i" 'nth($i)' "$available_disks" >/dev/null 2>&1; then _disk=$(mktmp) - jq -e --argjson i "$i" 'nth($i)' "$available_disks" > "$_disk" + jq -e --argjson i "$i" 'nth($i)' "$available_disks" >"$_disk" else warning "No disk selected. Select a disk to continue.\n" fi @@ -58,65 +58,66 @@ if ! [ "$NIX_ENVIRONMENT_VARIABLES_SET" ]; then warn "All data on disk $(jq '.item' "$_disk") will be deleted." readp "Continue with this disk? [N/y]: " result + # shellcheck disable=SC2154 case "$result" in - [Yy]) - msg "Great, continuing..." - _disk="$(jq '.item' "$_disk" | tr -d "\"")" - _disk_serial="$(udevadm info --query=all --name="$_disk" | grep ID_SERIAL= | awk 'BEGIN{FS="="}{print $2}')" - case "$_disk" in - "nvme"*) - _nix_disk="nvme-$_disk_serial" - ;; - "sd"*) - _nix_disk="ata-$_disk_serial" - ;; - *) - die "Disk with name '$_disk' and serial '$_disk_serial' not yet supported!" - ;; - esac - export NIX_DISK="$_nix_disk" + [Yy]) + msg "Great, continuing..." + _disk="$(jq '.item' "$_disk" | tr -d '"')" + _disk_serial="$(udevadm info --query=all --name="$_disk" | grep ID_SERIAL= | awk 'BEGIN{FS="="}{print $2}')" + case "$_disk" in + "nvme"*) + _nix_disk="nvme-$_disk_serial" + ;; + "sd"*) + _nix_disk="ata-$_disk_serial" ;; *) - msg "Sure, keep your data" - exit 1 + die "Disk with name '$_disk' and serial '$_disk_serial' not yet supported!" ;; + esac + export NIX_DISK="$_nix_disk" + ;; + *) + msg "Sure, keep your data" + exit 1 + ;; esac fi if ! [ "$ACTIVATE_TO_SETUP" ] && ! [ "$INSTALL" ]; then readp "Do you want to continue with nixos-install after activation? [N/y]: " result case $result in - [Yy]) - export ACTIVATE_TO_SETUP=yes - ;; - *) - export ACTIVATE_TO_SETUP=no - ;; + [Yy]) + export ACTIVATE_TO_SETUP=yes + ;; + *) + export ACTIVATE_TO_SETUP=no + ;; esac fi if ! [ "$INSTALL_TO_SETUP" ] && [ "$INSTALL" ]; then readp "Do you want to continue with nixos-install after disk formatting? [N/y]: " result case $result in - [Yy]) - export INSTALL_TO_SETUP=yes - ;; - *) - export INSTALL_TO_SETUP=no - ;; + [Yy]) + export INSTALL_TO_SETUP=yes + ;; + *) + export INSTALL_TO_SETUP=no + ;; esac fi if ! [ "$SETUP_TO_CONFIG_SETUP" ]; then readp "Do you want to continue with the user configuration setup after setup? [N/y]: " result case $result in - [Yy]) - export SETUP_TO_CONFIG_SETUP=yes - ;; - *) - export SETUP_TO_CONFIG_SETUP=no - ;; + [Yy]) + export SETUP_TO_CONFIG_SETUP=yes + ;; + *) + export SETUP_TO_CONFIG_SETUP=no + ;; esac fi - export NIX_ENVIRONMENT_VARIABLES_SET="set"; + export NIX_ENVIRONMENT_VARIABLES_SET="set" fi # vim: ft=sh diff --git a/cog.toml b/cog.toml index 34134317..7b3f4016 100644 --- a/cog.toml +++ b/cog.toml @@ -4,16 +4,14 @@ ignore_merge_commits = false pre_package_bump_hooks = [] post_package_bump_hooks = [] -branch_whitelist = [ - "prime", -] +branch_whitelist = ["prime"] pre_bump_hooks = [ - "nix flake check", # verify the project builds + "nix flake check", # verify the project builds ] post_bump_hooks = [ - "git push", - "git push origin v{{version}}", # push the new tag to origin + "git push", + "git push origin v{{version}}", # push the new tag to origin ] [commit_types] diff --git a/flake/default.nix b/flake/default.nix index 4e166b8a..7f28abb5 100644 --- a/flake/default.nix +++ b/flake/default.nix @@ -34,10 +34,10 @@ pkgs sysLib # extra information - + system # bins - + video_pause yambar_cpu yambar_memory @@ -46,10 +46,10 @@ river_init_lesser shell_library # external deps - + user_js # modules - + impermanence nixVim ; @@ -75,7 +75,7 @@ serverphone system # nix registry - + nixpkgs_as_input self ; @@ -150,7 +150,7 @@ in { pkgs nixpkgs_as_input # configs - + defaultModules defaultSpecialArgs ; diff --git a/hm/soispha/conf/alacritty/toml/hints.toml b/hm/soispha/conf/alacritty/toml/hints.toml index 33b21924..af01dc3e 100644 --- a/hm/soispha/conf/alacritty/toml/hints.toml +++ b/hm/soispha/conf/alacritty/toml/hints.toml @@ -2,12 +2,12 @@ alphabet = "jfkdls;ahgurieowpq" [[hints.enabled]] -command = "xdg-open" # On Linux/BSD -hyperlinks = true +command = "xdg-open" # On Linux/BSD +hyperlinks = true post_processing = true -persist = false -mouse.enabled = true -binding = { key = "U", mods = "Control|Shift" } +persist = false +mouse.enabled = true +binding = { key = "U", mods = "Control|Shift" } regex = "(ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file:|git://|ssh:|ftp://)[^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+" diff --git a/hm/soispha/conf/firefox/scripts/extract_cookies.sh b/hm/soispha/conf/firefox/scripts/extract_cookies.sh index e4eec72c..e3d50d43 100755 --- a/hm/soispha/conf/firefox/scripts/extract_cookies.sh +++ b/hm/soispha/conf/firefox/scripts/extract_cookies.sh @@ -10,7 +10,6 @@ # which means cookies which are kept only in memory ("session cookies") # will not be extracted. You will need an extension to do that. - # USAGE: # # $ extract_cookies.sh > /tmp/cookies.txt @@ -31,20 +30,17 @@ # # B) If you've redirected stdin (with < or |) , then that will be used. - # HISTORY: I believe this is circa 2010 from: # http://slacy.com/blog/2010/02/using-cookies-sqlite-in-wget-or-curl/ # However, that site is down now. # Cleaned up by Hackerb9 (2017) to be more robust and require less typing. - cleanup() { rm -f "$TMPFILE" exit 0 } -trap cleanup EXIT INT QUIT TERM - +trap cleanup EXIT INT QUIT TERM if [ "$#" -ge 1 ]; then SQLFILE="$1" @@ -59,14 +55,13 @@ fi # We have to copy cookies.sqlite, because FireFox has a lock on it TMPFILE=$(mktemp /tmp/cookies.sqlite.XXXXXXXXXX) -cat "$SQLFILE" >> "$TMPFILE" - +cat "$SQLFILE" >>"$TMPFILE" # This is the format of the sqlite database: # CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER); echo "# Netscape HTTP Cookie File" -sqlite3 -separator $'\t' "$TMPFILE" << EOF +sqlite3 -separator $'\t' "$TMPFILE" <<EOF .mode tabs .header off select host, diff --git a/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py b/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py index 90dfdd29..44e00d53 100755 --- a/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py +++ b/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py @@ -18,26 +18,27 @@ def mozlz4_to_text(filepath): def main(args): - # Given command-line arguments of an input filepath for a ".mozlz4" file - # and optionally an output filepath, write the decompressed text to the - # output filepath. - # Default output filepath is the input filepath minus the last three characters - # (e.g. "foo.jsonlz4" becomes "foo.json") - filepath_in = args[0] - if len(args) < 2: - filepath_out = filepath_in[:-3] - else: - filepath_out = args[1] - text = mozlz4_to_text(filepath_in) - with open(filepath_out, "wb") as outfile: - outfile.write(text) - print("Wrote decompressed text to {}".format(filepath_out)) + # Given command-line arguments of an input filepath for a ".mozlz4" file + # and optionally an output filepath, write the decompressed text to the + # output filepath. + # Default output filepath is the input filepath minus the last three characters + # (e.g. "foo.jsonlz4" becomes "foo.json") + filepath_in = args[0] + if len(args) < 2: + filepath_out = filepath_in[:-3] + else: + filepath_out = args[1] + text = mozlz4_to_text(filepath_in) + with open(filepath_out, "wb") as outfile: + outfile.write(text) + print("Wrote decompressed text to {}".format(filepath_out)) if __name__ == "__main__": - import sys - args = sys.argv[1:] - if args and not args[0] in ("--help", "-h"): - main(args) - else: - print("Usage: mozlz4.py <mozlz4 file to read> <location to write>") + import sys + + args = sys.argv[1:] + if args and not args[0] in ("--help", "-h"): + main(args) + else: + print("Usage: mozlz4.py <mozlz4 file to read> <location to write>") diff --git a/hm/soispha/conf/firefox/scripts/update_extensions.sh b/hm/soispha/conf/firefox/scripts/update_extensions.sh index f8ed3a9a..83b0146d 100755 --- a/hm/soispha/conf/firefox/scripts/update_extensions.sh +++ b/hm/soispha/conf/firefox/scripts/update_extensions.sh @@ -1,8 +1,7 @@ #!/bin/sh - tmp=$(mktemp) -cat << EOF > "$tmp" +cat <<EOF >"$tmp" darkreader:navbar keepassxc-browser:navbar vhack-libredirect:navbar @@ -15,8 +14,6 @@ EOF # The bin is provided in the devshell; # The cat execution should be unquoted; # shellcheck disable=SC2046 -generate_extensions $(cat "$tmp") > "$(dirname "$0")"/../config/extensions/extensions.json - - +generate_extensions $(cat "$tmp") >"$(dirname "$0")"/../config/extensions/extensions.json -rm "$tmp"; +rm "$tmp" diff --git a/hm/soispha/conf/git/scripts/commit.sh b/hm/soispha/conf/git/scripts/commit.sh index 9baf93bb..c0d706e2 100755 --- a/hm/soispha/conf/git/scripts/commit.sh +++ b/hm/soispha/conf/git/scripts/commit.sh @@ -3,17 +3,16 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH -ROOT="$(git rev-parse --show-toplevel)"; +ROOT="$(git rev-parse --show-toplevel)" # Take first line from previous commit if [ -f "$ROOT/.git/COMMIT_EDITMSG" ]; then - sed '1s/\(.*\)\((.*)\)\?\(:.*\)/\1\2: /;1p;d' "$ROOT/.git/COMMIT_EDITMSG" > "$ROOT/.git/COMMIT_TEMPLATE" + sed '1s/\(.*\)\((.*)\)\?\(:.*\)/\1\2: /;1p;d' "$ROOT/.git/COMMIT_EDITMSG" >"$ROOT/.git/COMMIT_TEMPLATE" else - printf "\n" > "$ROOT/.git/COMMIT_TEMPLATE" + printf "\n" >"$ROOT/.git/COMMIT_TEMPLATE" fi -sed '1d' "$(git config commit.template)" >> "$ROOT/.git/COMMIT_TEMPLATE" +sed '1d' "$(git config commit.template)" >>"$ROOT/.git/COMMIT_TEMPLATE" git commit --template "$ROOT/.git/COMMIT_TEMPLATE" --verbose "$@" - # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/default.nix b/hm/soispha/conf/lf/commands/default.nix index 1cb6996a..f5372a38 100644 --- a/hm/soispha/conf/lf/commands/default.nix +++ b/hm/soispha/conf/lf/commands/default.nix @@ -233,7 +233,7 @@ in { gnutar unzip # TODO: this is unfree! unrar - + p7zip ; }; diff --git a/hm/soispha/conf/lf/commands/scripts/archive.sh b/hm/soispha/conf/lf/commands/scripts/archive.sh index 5f4e3792..9ac07898 100755 --- a/hm/soispha/conf/lf/commands/scripts/archive.sh +++ b/hm/soispha/conf/lf/commands/scripts/archive.sh @@ -9,46 +9,52 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH # times. set -f -archivers="$(tmp echo gzip xz 7z zip)"; +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" + +archivers="$(tmp echo gzip xz 7z zip)" prompt "Archive name: " name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "Archive already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Archive name: " +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "Archive already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Archive name: " + fi fi - fi done -root="$(if [ "$(pwd)" = "/" ]; then pwd; else echo "$(pwd)/";fi)"; +root="$(if [ "$(pwd)" = "/" ]; then pwd; else echo "$(pwd)/"; fi)" # fx contains all selected file name separated by a newline while read -r raw_file; do - file="$(echo "$raw_file" | sed "s|$root||")"; - set -- "$@" "$file"; -done < "$(tmp echo "$fx")"; + file="$(echo "$raw_file" | sed "s|$root||")" + set -- "$@" "$file" +done <"$(tmp echo "$fx")" case "$(awk '{for (i=1; i<=NF; i++) print $i}' "$archivers" | fzf)" in - "gzip") - tar -czf "$name".tar.gz "$@" - ;; - "xz") - tar -cf "$name".tar "$@" - xz -z -9 -e -T0 "$name".tar - ;; - "7z") - 7z a "$name".7z "$@" - ;; - "zip") - zip --symlinks -r "$name".zip "$@" - ;; +"gzip") + tar -czf "$name".tar.gz "$@" + ;; +"xz") + tar -cf "$name".tar "$@" + xz -z -9 -e -T0 "$name".tar + ;; +"7z") + 7z a "$name".7z "$@" + ;; +"zip") + zip --symlinks -r "$name".zip "$@" + ;; esac # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/broot_jump.sh b/hm/soispha/conf/lf/commands/scripts/broot_jump.sh index 0feb5daf..4afb36ac 100755 --- a/hm/soispha/conf/lf/commands/scripts/broot_jump.sh +++ b/hm/soispha/conf/lf/commands/scripts/broot_jump.sh @@ -3,6 +3,15 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + tmp=$(mktmp) res="$(broot --outcmd "$tmp" && sed 's/cd //' "$tmp")" diff --git a/hm/soispha/conf/lf/commands/scripts/chmod.sh b/hm/soispha/conf/lf/commands/scripts/chmod.sh index f2cc0dc8..81373352 100755 --- a/hm/soispha/conf/lf/commands/scripts/chmod.sh +++ b/hm/soispha/conf/lf/commands/scripts/chmod.sh @@ -3,11 +3,22 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + readp "Mode bits: " bits +# shellcheck disable=SC2269 +bits="$bits" while read -r file; do chmod "$bits" "$file" -done < "$(tmp echo "$fx")" +done <"$(tmp echo "$fx")" lf -remote 'send reload' # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/cow_cp.sh b/hm/soispha/conf/lf/commands/scripts/cow_cp.sh index 85fd3431..c17b7668 100755 --- a/hm/soispha/conf/lf/commands/scripts/cow_cp.sh +++ b/hm/soispha/conf/lf/commands/scripts/cow_cp.sh @@ -1,8 +1,17 @@ -#!/usr/bin/env dash +#!/usr/bin/env bash # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + # source: https://github.com/gokcehan/lf/wiki/Tips#use-copy-on-write-when-possible # # # FIXME: Add this. The hardest part is in checking, if a file can be reflinked, as fuse and bind mount are hard to @@ -31,13 +40,13 @@ if [ "$mode" = 'copy' ]; then src_targets="$(df --output=target -- "$@" | sed '1d' | sort -u)" if [ "$(df --output=target -- "$PWD" | tail -n 1)" = \ - "$(echo "$src_targets" | tail -n 1)" ] && \ - (( "$(echo "$src_targets" | wc -l)" == 1 )) && \ + "$(echo "$src_targets" | tail -n 1)" ] && + (("$(echo "$src_targets" | wc -l)" == 1)) && [[ "$(df --output=fstype -- "$PWD" | tail -n 1)" =~ ^(btrfs|xfs|zfs)$ ]]; then - echo 'selected copy and cp reflink paste' + echo 'selected copy and cp reflink paste' - start=$(date '+%s') + start=$(date '+%s') # Handle same names in dst # TODO parallelism, idk - but exit/return/break won't stop the loop from subshell... @@ -47,7 +56,7 @@ if [ "$mode" = 'copy' ]; then count=0 while [ -w "$PWD/$name" ]; do - count=$((count+1)) + count=$((count + 1)) name="$original.~$count~" done @@ -55,15 +64,15 @@ if [ "$mode" = 'copy' ]; then cp_out="$(cp -rn --reflink=always -- "$i" "$PWD/$name" 2>&1)" set -e - if [ ! -z "$cp_out" ]; then + if [ -n "$cp_out" ]; then lf -remote "send $id echoerr $cp_out" exit 0 fi done - finish=$(( $(date '+%s') - $start )) + finish=$(($(date '+%s') - start)) t='' - if (( $finish > 2 )); then + if ((finish > 2)); then t="${finish}s" fi @@ -80,14 +89,14 @@ if [ "$mode" = 'copy' ]; then echo 'selected copy and lf native paste' lf -remote "send $id paste" lf -remote "send clear" - fi - - elif [ $mode = 'move' ]; then - echo 'selected move and lf native paste' - lf -remote "send $id paste" - lf -remote "send clear" fi +elif [ "$mode" = 'move' ]; then + echo 'selected move and lf native paste' + lf -remote "send $id paste" + lf -remote "send clear" +fi + # # for debug # set +x diff --git a/hm/soispha/conf/lf/commands/scripts/dl_file.sh b/hm/soispha/conf/lf/commands/scripts/dl_file.sh index 5092174f..4f97f9b9 100755 --- a/hm/soispha/conf/lf/commands/scripts/dl_file.sh +++ b/hm/soispha/conf/lf/commands/scripts/dl_file.sh @@ -3,31 +3,41 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + # Provides the ability to download a file by dropping it into a window url="$(dragon -t -x)" if [ -n "$url" ]; then - prompt "File Name: " - name="" - while [ -z "$name" ] || [ -e "$name" ] - do - read -r name - if [ -e "$name" ]; then - prompt "File already exists, overwrite [y|N]: " - read -r ans + prompt "File Name: " + name="" + while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "File already exists, overwrite [y|N]: " + read -r ans - if [ "$ans" = "y" ]; then - break - else - prompt "File Name: " - fi - fi - done + if [ "$ans" = "y" ]; then + break + else + prompt "File Name: " + fi + fi + done - # Download the file with curl - [ -n "$name" ] && curl -o "$name" "$url" || die "curl failed" + # Download the file with curl + if [ -n "$name" ]; then + curl -o "$name" "$url" || die "curl failed" + fi else - die "URL is null!" + die "URL is null!" fi # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/dragon.sh b/hm/soispha/conf/lf/commands/scripts/dragon.sh index 59a50920..70633583 100755 --- a/hm/soispha/conf/lf/commands/scripts/dragon.sh +++ b/hm/soispha/conf/lf/commands/scripts/dragon.sh @@ -3,9 +3,18 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + while read -r file; do set -- "$@" "$file" -done < "$(tmp echo "$fx")" +done <"$(tmp echo "$fx")" dragon -a -x "$@" # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/dragon_individual.sh b/hm/soispha/conf/lf/commands/scripts/dragon_individual.sh index 051537f9..500be67c 100755 --- a/hm/soispha/conf/lf/commands/scripts/dragon_individual.sh +++ b/hm/soispha/conf/lf/commands/scripts/dragon_individual.sh @@ -3,9 +3,18 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + while read -r file; do set -- "$@" "$file" -done < "$(tmp echo "$fx")" +done <"$(tmp echo "$fx")" dragon "$@" # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/dragon_stay.sh b/hm/soispha/conf/lf/commands/scripts/dragon_stay.sh index 8f880848..273482ea 100755 --- a/hm/soispha/conf/lf/commands/scripts/dragon_stay.sh +++ b/hm/soispha/conf/lf/commands/scripts/dragon_stay.sh @@ -3,9 +3,18 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + while read -r file; do - set -- "$@" "$file"; -done < "$(tmp echo "$fx")" + set -- "$@" "$file" +done <"$(tmp echo "$fx")" dragon -a "$@" # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/fzf_jump.sh b/hm/soispha/conf/lf/commands/scripts/fzf_jump.sh index 172c44d3..6f8981f3 100755 --- a/hm/soispha/conf/lf/commands/scripts/fzf_jump.sh +++ b/hm/soispha/conf/lf/commands/scripts/fzf_jump.sh @@ -5,12 +5,20 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH res="$(fd . --maxdepth 3 | fzf --header='Jump to location')" +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + if [ -f "$res" ]; then cmd="select" elif [ -d "$res" ]; then cmd="cd" fi - lf -remote "send $id $cmd \"$res\"" # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/go_project_root.sh b/hm/soispha/conf/lf/commands/scripts/go_project_root.sh index 9ed9f7ad..e1147fce 100755 --- a/hm/soispha/conf/lf/commands/scripts/go_project_root.sh +++ b/hm/soispha/conf/lf/commands/scripts/go_project_root.sh @@ -3,11 +3,20 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH -flake_base_dir="$(search_flake_base_dir)"; +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +flake_base_dir="$(search_flake_base_dir)" if [ "$flake_base_dir" ]; then lf -remote "send $id cd $flake_base_dir" || die "Bug: No base dir ($flake_base_dir)" else - die "Unable to locate base dir"; + die "Unable to locate base dir" fi # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/mk_dir.sh b/hm/soispha/conf/lf/commands/scripts/mk_dir.sh index adf60d99..6079b85d 100755 --- a/hm/soispha/conf/lf/commands/scripts/mk_dir.sh +++ b/hm/soispha/conf/lf/commands/scripts/mk_dir.sh @@ -3,21 +3,29 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + prompt "Directory Name: " name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "Directory already exists, overwrite [y|N]: " - read -r ans +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "Directory already exists, overwrite [y|N]: " + read -r ans - if [ "$ans" = "y" ]; then - break - else - prompt "Directory Name: " + if [ "$ans" = "y" ]; then + break + else + prompt "Directory Name: " + fi fi - fi done mkdir "$name" diff --git a/hm/soispha/conf/lf/commands/scripts/mk_file.sh b/hm/soispha/conf/lf/commands/scripts/mk_file.sh index cdef38a0..9fb0a000 100755 --- a/hm/soispha/conf/lf/commands/scripts/mk_file.sh +++ b/hm/soispha/conf/lf/commands/scripts/mk_file.sh @@ -3,21 +3,29 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + prompt "File name: " name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "File already exists, overwrite [y|N]: " - read -r ans +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "File already exists, overwrite [y|N]: " + read -r ans - if [ "$ans" = "y" ]; then - break - else - prompt "File name: " + if [ "$ans" = "y" ]; then + break + else + prompt "File name: " + fi fi - fi done touch "$name" diff --git a/hm/soispha/conf/lf/commands/scripts/mk_file_and_edit.sh b/hm/soispha/conf/lf/commands/scripts/mk_file_and_edit.sh index 662b29ac..2007cc99 100755 --- a/hm/soispha/conf/lf/commands/scripts/mk_file_and_edit.sh +++ b/hm/soispha/conf/lf/commands/scripts/mk_file_and_edit.sh @@ -3,21 +3,29 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + prompt "File name: " name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "File already exists, overwrite [y|N]: " - read -r ans +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "File already exists, overwrite [y|N]: " + read -r ans - if [ "$ans" = "y" ]; then - break - else - prompt "File name: " + if [ "$ans" = "y" ]; then + break + else + prompt "File name: " + fi fi - fi done touch "$name" diff --git a/hm/soispha/conf/lf/commands/scripts/mk_ln.sh b/hm/soispha/conf/lf/commands/scripts/mk_ln.sh index f5dcd395..e767c848 100755 --- a/hm/soispha/conf/lf/commands/scripts/mk_ln.sh +++ b/hm/soispha/conf/lf/commands/scripts/mk_ln.sh @@ -3,9 +3,18 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH -while IFS= read -r i;do +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +while IFS= read -r i; do set -- "$@" "$i" -done < "$HOME"/.local/share/lf/files +done <"$HOME"/.local/share/lf/files mode="$1" shift @@ -16,20 +25,20 @@ if [ "$#" -eq 0 ]; then fi case "$mode" in - copy) - while [ "$#" -gt 0 ]; do - file="$1" - ans="$(basename "$file")" - - while [ -e "$ans" ];do - prompt "$ans already exists, new name for link: " - read -r ans - done - - ln -s "$file" "$(pwd)/$ans" - shift +copy) + while [ "$#" -gt 0 ]; do + file="$1" + ans="$(basename "$file")" + + while [ -e "$ans" ]; do + prompt "$ans already exists, new name for link: " + read -r ans done - ;; + + ln -s "$file" "$(pwd)/$ans" + shift + done + ;; esac rm ~/.local/share/lf/files # lf -remote "send clear" diff --git a/hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh b/hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh index 6e69fc4f..915725cc 100755 --- a/hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh +++ b/hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh @@ -3,29 +3,35 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" prompt "Script name: " name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "Script already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Script Name: " +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "Script already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Script Name: " + fi fi - fi done script="$(pwd)"/"$name" -cat "%SHELL_LIBRARY_TEMPLATE" > "$script" +cat "%SHELL_LIBRARY_TEMPLATE" >"$script" chmod +x "$script" "$VISUAL" "$script" - # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/mk_scr_temp.sh b/hm/soispha/conf/lf/commands/scripts/mk_scr_temp.sh index 612ff19d..0f8394fa 100755 --- a/hm/soispha/conf/lf/commands/scripts/mk_scr_temp.sh +++ b/hm/soispha/conf/lf/commands/scripts/mk_scr_temp.sh @@ -3,30 +3,36 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" prompt "Script name: " name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "Script already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Script Name: " +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "Script already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Script Name: " + fi fi - fi done script="$(pwd)"/"$name" -sed 's|%TO_BE_SHELL_LIBRARY_PATH|%SHELL_LIBRARY_PATH|' "%SHELL_LIBRARY_TEMPLATE" > "$script" +sed 's|%TO_BE_SHELL_LIBRARY_PATH|%SHELL_LIBRARY_PATH|' "%SHELL_LIBRARY_TEMPLATE" >"$script" sed -i 's|dash|sh|' "$script" chmod +x "$script" "$VISUAL" "$script" - # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/open.sh b/hm/soispha/conf/lf/commands/scripts/open.sh index 3dd8f485..4df06dd8 100755 --- a/hm/soispha/conf/lf/commands/scripts/open.sh +++ b/hm/soispha/conf/lf/commands/scripts/open.sh @@ -3,9 +3,18 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + case $(file --mime-type "$f" -bL) in - text/*|application/json|application/vnd.hp-HPGL) "$EDITOR" "$f";; - image/*) "$IVIEWER" "$f";; - *) xdg-open "$f";; +text/* | application/json | application/vnd.hp-HPGL) "$EDITOR" "$f" ;; +image/*) "$IVIEWER" "$f" ;; +*) xdg-open "$f" ;; esac # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/open_config.sh b/hm/soispha/conf/lf/commands/scripts/open_config.sh index 4054abdd..455ca25a 100755 --- a/hm/soispha/conf/lf/commands/scripts/open_config.sh +++ b/hm/soispha/conf/lf/commands/scripts/open_config.sh @@ -3,5 +3,14 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + "$EDITOR" "$(bookmenu -b ~/.config/bookmenu/configs -f fzf -o)" # TODO: implement this # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/restore_trash.sh b/hm/soispha/conf/lf/commands/scripts/restore_trash.sh index 94d26a26..7aeed7bf 100755 --- a/hm/soispha/conf/lf/commands/scripts/restore_trash.sh +++ b/hm/soispha/conf/lf/commands/scripts/restore_trash.sh @@ -3,5 +3,14 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + trash list | fzf --multi | awk '{print $NF}' | xargs trash restore --match=exact # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/set_wall_paper.sh b/hm/soispha/conf/lf/commands/scripts/set_wall_paper.sh index f7714880..828c0708 100755 --- a/hm/soispha/conf/lf/commands/scripts/set_wall_paper.sh +++ b/hm/soispha/conf/lf/commands/scripts/set_wall_paper.sh @@ -3,6 +3,15 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + die "No yet implemented" # TODO: do what the 'die' says #sed -i "s,export AWMWALLPAPER='.*',export AWMWALLPAPER='${f}'," ${ZDOTDIR}/.zshenv #nohub swaybg -i "$f" diff --git a/hm/soispha/conf/lf/commands/scripts/stripspace.sh b/hm/soispha/conf/lf/commands/scripts/stripspace.sh index c8781a60..65eefbcd 100755 --- a/hm/soispha/conf/lf/commands/scripts/stripspace.sh +++ b/hm/soispha/conf/lf/commands/scripts/stripspace.sh @@ -3,11 +3,20 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH -files=$(mktmp); -echo "$fx" > "$files"; +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" -awk_source=$(mktmp); -cat << OFT > "$awk_source" +files=$(mktmp) +echo "$fx" >"$files" + +awk_source=$(mktmp) +cat <<OFT >"$awk_source" BEGIN {FS=" "} {for (i=1; i != NF + 1; i++) if (i == NF) { @@ -21,11 +30,11 @@ OFT while read -r file; do dirty_name=$(mktmp) - basename "$file" > "$dirty_name"; - clean_name=$(awk -f "$awk_source" "$dirty_name"); + basename "$file" >"$dirty_name" + clean_name=$(awk -f "$awk_source" "$dirty_name") - [ -e "$clean_name" ] && die "file \"$clean_name\" already exists!"; - mv "$(cat "$dirty_name")" "$clean_name" || die "Move failed"; + [ -e "$clean_name" ] && die "file \"$clean_name\" already exists!" + mv "$(cat "$dirty_name")" "$clean_name" || die "Move failed" lf -remote 'send reload' -done < "$files"; +done <"$files" # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/trash.sh b/hm/soispha/conf/lf/commands/scripts/trash.sh index 4da188e5..c605420e 100755 --- a/hm/soispha/conf/lf/commands/scripts/trash.sh +++ b/hm/soispha/conf/lf/commands/scripts/trash.sh @@ -3,26 +3,35 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH -trash_output=$(mktmp); -expected_error_output=$(mktmp); +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +trash_output=$(mktmp) +expected_error_output=$(mktmp) while read -r file; do set -- "$@" "$file" -done < "$(tmp echo "$fx")" +done <"$(tmp echo "$fx")" # TODO: why are we using trashy at all, when trash-cli can do everything? # # try trashy first, through nix because both trashy and trash-cli provide a trash command, which conflicts -nix run nixpkgs#trashy -- put "$@" 2> "$trash_output"; +nix run nixpkgs#trashy -- put "$@" 2>"$trash_output" # FIXME: Find a way, that does not depend on parsing an error message <2023-08-29> -cat << EOF > "$expected_error_output"; +cat <<EOF >"$expected_error_output" [1;31merror:[0m Error during a \`trash\` operation: Unknown { description: "Path: '\"/.Trash-1000\"'. Message: Permission denied (os error 13)" } EOF -if [ "$(cat "$expected_error_output")" = "$(cat "$trash_output")" ];then - warning "Deleting with trash-cli to the /.Trash folder"; +if [ "$(cat "$expected_error_output")" = "$(cat "$trash_output")" ]; then + warning "Deleting with trash-cli to the /.Trash folder" # this file could not be trashed because it is on the tempfs volume, trash-cli can do this this - trash-put "$@"; + trash-put "$@" fi # vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/unarchive.sh b/hm/soispha/conf/lf/commands/scripts/unarchive.sh index 1ecc702b..d52eee61 100755 --- a/hm/soispha/conf/lf/commands/scripts/unarchive.sh +++ b/hm/soispha/conf/lf/commands/scripts/unarchive.sh @@ -3,20 +3,29 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + # extract the current file with the right command # (xkcd link: https://xkcd.com/1168/) set -f # TODO: add support for multiple files at once case "$f" in - *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf "$f";; - *.tar.gz|*.tgz) tar xzvf "$f";; - *.tar.xz|*.txz) tar xJvf "$f";; - *.zip) unzip "$f";; - *.rar) - die "rar is a unfree format!" - #unrar x $f - ;; - *.7z) 7z x "$f";; - *) die "Unsupported format" ;; +*.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar xjvf "$f" ;; +*.tar.gz | *.tgz) tar xzvf "$f" ;; +*.tar.xz | *.txz) tar xJvf "$f" ;; +*.zip) unzip "$f" ;; +*.rar) + die "rar is a unfree format!" + #unrar x $f + ;; +*.7z) 7z x "$f" ;; +*) die "Unsupported format" ;; esac # vim: ft=sh diff --git a/hm/soispha/conf/nvim/files/ftplugin/tex.lua b/hm/soispha/conf/nvim/files/ftplugin/tex.lua index 05a2c593..f3fffa86 100644 --- a/hm/soispha/conf/nvim/files/ftplugin/tex.lua +++ b/hm/soispha/conf/nvim/files/ftplugin/tex.lua @@ -19,40 +19,39 @@ -- -- - -- Set tex specific telescope extension require("telescope").setup({ extensions = { bibtex = { -- Depth for the *.bib file - depth = 1; + depth = 1, -- Path to global bibliographies (placed outside of the project) - global_files = {}; + global_files = {}, -- Define the search keys to use in the picker - search_keys = { "author"; "year"; "title"; }; + search_keys = { "author", "year", "title" }, -- Template for the formatted citation - citation_format = "{{author}} ({{year}}), {{title}}."; + citation_format = "{{author}} ({{year}}), {{title}}.", -- Only use initials for the authors first name - citation_trim_firstname = true; + citation_trim_firstname = true, -- Max number of authors to write in the formatted citation -- following authors will be replaced by "et al." - citation_max_auth = 2; + citation_max_auth = 2, -- Wrapping in the preview window is disabled by default - wrap = false; + wrap = false, -- Custom format for citation label custom_formats = { - { id = "tex_autocite"; cite_marker = "\\autocite{%s}"; }; - }; - format = "tex_autocite"; + { id = "tex_autocite", cite_marker = "\\autocite{%s}" }, + }, + format = "tex_autocite", -- Use context awareness - context = true; + context = true, -- Fallback to global/directory .bib files if context not found -- This setting has no effect if context = false - context_fallback = true; - }; - }; + context_fallback = true, + }, + }, }) require("telescope").load_extension("bibtex") vim.keymap.set("n", "<leader>ib", function() - require("telescope").extensions.bibtex.bibtex() - end, { noremap = true; silent = true; desc = "list bibtex entries in telescope"; }) + require("telescope").extensions.bibtex.bibtex() +end, { noremap = true, silent = true, desc = "list bibtex entries in telescope" }) diff --git a/hm/soispha/conf/nvim/plgs/colorscheme/lua/mk_todos_readable.lua b/hm/soispha/conf/nvim/plgs/colorscheme/lua/mk_todos_readable.lua index ee28151c..d02171b5 100644 --- a/hm/soispha/conf/nvim/plgs/colorscheme/lua/mk_todos_readable.lua +++ b/hm/soispha/conf/nvim/plgs/colorscheme/lua/mk_todos_readable.lua @@ -1,17 +1,16 @@ -local opts = { bg = "NONE"; bold = true; } - +local opts = { bg = "NONE", bold = true } ---@param hl_group string: The name of the hl group ---@param extra_opts table: Extra options to pass to nvim_set_hl local set_hl = function(hl_group, extra_opts) - local local_opts = vim.deepcopy(opts); + local local_opts = vim.deepcopy(opts) for k, v in ipairs(extra_opts) do - local_opts[k] = v; + local_opts[k] = v end vim.api.nvim_set_hl(0, hl_group, local_opts) end -set_hl("@text.danger", { fg = "red"; }) -set_hl("@text.note", { fg = "blue"; }) -set_hl("@text.todo", { fg = "green"; }) -set_hl("@text.warning", { fg = "yellow"; }) +set_hl("@text.danger", { fg = "red" }) +set_hl("@text.note", { fg = "blue" }) +set_hl("@text.todo", { fg = "green" }) +set_hl("@text.warning", { fg = "yellow" }) diff --git a/hm/soispha/conf/nvim/plgs/colorscheme/lua/nightfox.lua b/hm/soispha/conf/nvim/plgs/colorscheme/lua/nightfox.lua index 025eb133..4c502153 100644 --- a/hm/soispha/conf/nvim/plgs/colorscheme/lua/nightfox.lua +++ b/hm/soispha/conf/nvim/plgs/colorscheme/lua/nightfox.lua @@ -1,44 +1,44 @@ require("nightfox").setup({ options = { -- Compiled file's destination location - compile_path = vim.fn.stdpath("cache") .. "/nightfox"; - compile_file_suffix = "_compiled"; -- Compiled file suffix - transparent = true; -- Disable setting background - terminal_colors = true; -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` - dim_inactive = true; -- Non focused panes set to alternative background - module_default = true; -- Default enable value for modules + compile_path = vim.fn.stdpath("cache") .. "/nightfox", + compile_file_suffix = "_compiled", -- Compiled file suffix + transparent = true, -- Disable setting background + terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + dim_inactive = true, -- Non focused panes set to alternative background + module_default = true, -- Default enable value for modules colorblind = { - enable = true; -- Enable colorblind support - simulate_only = false; -- Only show simulated colorblind colors and not diff shifted + enable = true, -- Enable colorblind support + simulate_only = false, -- Only show simulated colorblind colors and not diff shifted severity = { - protan = 0.3; -- Severity [0,1] for protan (red) - deutan = 0.9; -- Severity [0,1] for deutan (green) - tritan = 0; -- Severity [0,1] for tritan (blue) - }; - }; - styles = { -- Style to be applied to different syntax groups - comments = "italic"; -- Value is any valid attr-list value `:help attr-list` - conditionals = "NONE"; - constants = "NONE"; - functions = "bold"; - keywords = "bold"; - numbers = "NONE"; - operators = "NONE"; - strings = "NONE"; - types = "NONE"; - variables = "NONE"; - }; + protan = 0.3, -- Severity [0,1] for protan (red) + deutan = 0.9, -- Severity [0,1] for deutan (green) + tritan = 0, -- Severity [0,1] for tritan (blue) + }, + }, + styles = { -- Style to be applied to different syntax groups + comments = "italic", -- Value is any valid attr-list value `:help attr-list` + conditionals = "NONE", + constants = "NONE", + functions = "bold", + keywords = "bold", + numbers = "NONE", + operators = "NONE", + strings = "NONE", + types = "NONE", + variables = "NONE", + }, inverse = { -- Inverse highlight for different types - match_paren = false; - visual = false; - search = false; - }; + match_paren = false, + visual = false, + search = false, + }, modules = { -- List of various plugins and additional options - diagnostic = { enable = true; background = false; }; - native_lsp = { enable = true; background = false; }; - }; - }; - palettes = {}; - specs = {}; - groups = {}; + diagnostic = { enable = true, background = false }, + native_lsp = { enable = true, background = false }, + }, + }, + palettes = {}, + specs = {}, + groups = {}, }) diff --git a/hm/soispha/conf/nvim/plgs/debugprint/lua/debugprint.lua b/hm/soispha/conf/nvim/plgs/debugprint/lua/debugprint.lua index 2ea38df4..da7e1735 100644 --- a/hm/soispha/conf/nvim/plgs/debugprint/lua/debugprint.lua +++ b/hm/soispha/conf/nvim/plgs/debugprint/lua/debugprint.lua @@ -1,4 +1,3 @@ require("debugprint").setup({ - create_keymaps = false; + create_keymaps = false, }) - diff --git a/hm/soispha/conf/nvim/plgs/femaco/lua/femaco.lua b/hm/soispha/conf/nvim/plgs/femaco/lua/femaco.lua index 10064b5e..da3be8e1 100644 --- a/hm/soispha/conf/nvim/plgs/femaco/lua/femaco.lua +++ b/hm/soispha/conf/nvim/plgs/femaco/lua/femaco.lua @@ -1,4 +1,4 @@ -local clip_val = require('femaco.utils').clip_val +local clip_val = require("femaco.utils").clip_val require("femaco").setup({ -- should prepare a new buffer and return the winid -- by default opens a floating window @@ -7,7 +7,7 @@ require("femaco").setup({ prepare_buffer = function(opts) local buf = vim.api.nvim_create_buf(false, false) return vim.api.nvim_open_win(buf, true, opts) - end; + end, -- should return options passed to nvim_open_win -- @param code_block: data about the code-block with the keys -- * range @@ -15,30 +15,30 @@ require("femaco").setup({ -- * lang float_opts = function(code_block) return { - relative = "cursor"; - width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10); -- TODO: how to offset sign column etc? - height = clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6); - anchor = "NW"; - row = 0; - col = 0; - style = "minimal"; - border = "rounded"; - zindex = 1; + relative = "cursor", + width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10), -- TODO: how to offset sign column etc? + height = clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6), + anchor = "NW", + row = 0, + col = 0, + style = "minimal", + border = "rounded", + zindex = 1, } - end; + end, -- return filetype to use for a given lang -- lang can be nil ft_from_lang = function(lang) return lang - end; + end, -- what to do after opening the float post_open_float = function(winnr) vim.wo.signcolumn = "no" - end; + end, -- create the path to a temporary file create_tmp_filepath = function(filetype) return os.tmpname() - end; + end, -- if a newline should always be used, useful for multiline injections -- which separators needs to be on separate lines such as markdown, neorg etc -- @param base_filetype: The filetype which FeMaco is called from, not the @@ -46,5 +46,5 @@ require("femaco").setup({ -- get it from vim.bo.filetyp). ensure_newline = function(base_filetype) return false - end; + end, }) diff --git a/hm/soispha/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua b/hm/soispha/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua index 8db7d293..42ea1eb6 100644 --- a/hm/soispha/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua +++ b/hm/soispha/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua @@ -21,16 +21,16 @@ require("flatten").setup({ ---Called to determine if a nested session should wait for the host to close the file. ---param argv: a list of all the arguments in the nested session ---@type fun(argv: table): boolean - should_block = require("flatten").default_should_block; + should_block = require("flatten").default_should_block, ---If this returns true, the nested session will be opened. ---If false, default behavior is used, and ---config.nest_if_no_args is respected. ---@type fun(host: channel):boolean - should_nest = require("flatten").default_should_nest; + should_nest = require("flatten").default_should_nest, ---Called before a nested session is opened. - pre_open = function() end; + pre_open = function() end, ---Called after a nested session is opened. ---@param bufnr buffer @@ -42,27 +42,27 @@ require("flatten").setup({ -- If the file is a git commit, create one-shot autocmd to delete its buffer on write if filetype == "gitcommit" or filetype == "gitrebase" then vim.api.nvim_create_autocmd("BufWritePost", { - buffer = bufnr; - once = true; + buffer = bufnr, + once = true, callback = vim.schedule_wrap(function() vim.api.nvim_buf_delete(bufnr, {}) - end); + end), }) end - end; + end, ---Called when a nested session is done waiting for the host. ---@param filetype string - block_end = function(filetype) end; - }; + block_end = function(filetype) end, + }, -- <String, Bool> dictionary of filetypes that should be blocking block_for = { - gitcommit = true; - }; + gitcommit = true, + }, -- Command passthrough - allow_cmd_passthrough = true; + allow_cmd_passthrough = true, -- Allow a nested session to open if Neovim is opened without arguments - nest_if_no_args = false; + nest_if_no_args = false, -- Window options window = { -- Options: @@ -75,7 +75,7 @@ require("flatten").setup({ -- OpenHandler -> allows you to handle file opening yourself (see Types) -- -- TODO: Open gitcommit filetypes in the current buffer, everything else in a new tab <2023-08-29> - open = "split"; + open = "split", -- Options: -- vsplit -> opens files in diff vsplits @@ -83,24 +83,24 @@ require("flatten").setup({ -- tab_vsplit -> creates a new tabpage, and opens diff vsplits -- tab_split -> creates a new tabpage, and opens diff splits -- OpenHandler -> allows you to handle file opening yourself (see Types) - diff = "tab_vsplit"; + diff = "tab_vsplit", -- Affects which file gets focused when opening multiple at once -- Options: -- "first" -> open first file of new files (default) -- "last" -> open last file of new files - focus = "first"; - }; + focus = "first", + }, -- Override this function to use a different socket to connect to the host -- On the host side this can return nil or the socket address. -- On the guest side this should return the socket address -- or a non-zero channel id from `sockconnect` -- flatten.nvim will detect if the address refers to this instance of nvim, to determine if this is a host or a guest - pipe_path = require"flatten".default_pipe_path; + pipe_path = require("flatten").default_pipe_path, -- The `default_pipe_path` will treat the first nvim instance within a single kitty/wezterm session as the host -- You can configure this behaviour using the following: one_per = { - kitty = true; -- Flatten all instance in the current Kitty session - wezterm = true; -- Flatten all instance in the current Wezterm session - }; + kitty = true, -- Flatten all instance in the current Kitty session + wezterm = true, -- Flatten all instance in the current Wezterm session + }, }) diff --git a/hm/soispha/conf/nvim/plgs/goto-preview/lua/goto-preview.lua b/hm/soispha/conf/nvim/plgs/goto-preview/lua/goto-preview.lua index cde50d3e..9687a5a0 100644 --- a/hm/soispha/conf/nvim/plgs/goto-preview/lua/goto-preview.lua +++ b/hm/soispha/conf/nvim/plgs/goto-preview/lua/goto-preview.lua @@ -1,21 +1,21 @@ require("goto-preview").setup({ - width = 120; -- Width of the floating window - height = 15; -- Height of the floating window - border = { "↖"; "─"; "┐"; "│"; "┘"; "─"; "└"; "│"; }; -- Border characters of the floating window - default_mappings = false; -- Bind default mappings - debug = false; -- Print debug information - opacity = nil; -- 0-100 opacity level of the floating window where 100 is fully transparent. - resizing_mappings = false; -- Binds arrow keys to resizing the floating window. - post_open_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook. - post_close_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook. + width = 120, -- Width of the floating window + height = 15, -- Height of the floating window + border = { "↖", "─", "┐", "│", "┘", "─", "└", "│" }, -- Border characters of the floating window + default_mappings = false, -- Bind default mappings + debug = false, -- Print debug information + opacity = nil, -- 0-100 opacity level of the floating window where 100 is fully transparent. + resizing_mappings = false, -- Binds arrow keys to resizing the floating window. + post_open_hook = nil, -- A function taking two arguments, a buffer and a window to be ran as a hook. + post_close_hook = nil, -- A function taking two arguments, a buffer and a window to be ran as a hook. references = { -- Configure the telescope UI for slowing the references cycling window. - telescope = {}; -- require("telescope.themes").get_dropdown({ hide_preview = false }) - }; + telescope = {}, -- require("telescope.themes").get_dropdown({ hide_preview = false }) + }, -- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality. - focus_on_open = true; -- Focus the floating window when opening it. - dismiss_on_move = false; -- Dismiss the floating window when moving the cursor. - force_close = true; -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close - bufhidden = "wipe"; -- the bufhidden option to set on the floating window. See :h bufhidden - stack_floating_preview_windows = true; -- Whether to nest floating windows - preview_window_title = { enable = true; position = "left"; }; -- Whether to set the preview window title as the filename + focus_on_open = true, -- Focus the floating window when opening it. + dismiss_on_move = false, -- Dismiss the floating window when moving the cursor. + force_close = true, -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close + bufhidden = "wipe", -- the bufhidden option to set on the floating window. See :h bufhidden + stack_floating_preview_windows = true, -- Whether to nest floating windows + preview_window_title = { enable = true, position = "left" }, -- Whether to set the preview window title as the filename }) diff --git a/hm/soispha/conf/nvim/plgs/lf-nvim/lua/lf-nvim.lua b/hm/soispha/conf/nvim/plgs/lf-nvim/lua/lf-nvim.lua index 8a0cf817..1eadf375 100644 --- a/hm/soispha/conf/nvim/plgs/lf-nvim/lua/lf-nvim.lua +++ b/hm/soispha/conf/nvim/plgs/lf-nvim/lua/lf-nvim.lua @@ -2,42 +2,42 @@ local fn = vim.fn -- Defaults require("lf").setup({ - default_action = "drop"; -- default action when `Lf` opens a file + default_action = "drop", -- default action when `Lf` opens a file -- TODO: what do these mappings do? - default_actions = { -- default action keybindings - ["<C-t>"] = "tabedit"; - ["<C-x>"] = "split"; - ["<C-v>"] = "vsplit"; - ["<C-o>"] = "tab drop"; - }; + default_actions = { -- default action keybindings + ["<C-t>"] = "tabedit", + ["<C-x>"] = "split", + ["<C-v>"] = "vsplit", + ["<C-o>"] = "tab drop", + }, - winblend = 10; -- psuedotransparency level - dir = ""; -- directory where `lf` starts ('gwd' is git-working-directory, ""/nil is CWD) - direction = "float"; -- window type: float horizontal vertical - border = "rounded"; -- border kind: single double shadow curved - height = fn.float2nr(fn.round(0.75 * vim.o.lines)); -- height of the *floating* window - width = fn.float2nr(fn.round(0.75 * vim.o.columns)); -- width of the *floating* window - escape_quit = true; -- map escape to the quit command (so it doesn't go into a meta normal mode) - focus_on_open = true; -- focus the current file when opening Lf (experimental) - mappings = true; -- whether terminal buffer mapping is enabled - tmux = false; -- tmux statusline can be disabled on opening of Lf - default_file_manager = true; -- make lf default file manager - disable_netrw_warning = true; -- don't display a message when opening a directory with `default_file_manager` as true - highlights = { -- highlights passed to toggleterm - Normal = { link = "Normal"; }; - NormalFloat = { link = "Normal"; }; - FloatBorder = { guifg = "#cdcbe0"; guibg = "#191726"; }; - }; + winblend = 10, -- psuedotransparency level + dir = "", -- directory where `lf` starts ('gwd' is git-working-directory, ""/nil is CWD) + direction = "float", -- window type: float horizontal vertical + border = "rounded", -- border kind: single double shadow curved + height = fn.float2nr(fn.round(0.75 * vim.o.lines)), -- height of the *floating* window + width = fn.float2nr(fn.round(0.75 * vim.o.columns)), -- width of the *floating* window + escape_quit = true, -- map escape to the quit command (so it doesn't go into a meta normal mode) + focus_on_open = true, -- focus the current file when opening Lf (experimental) + mappings = true, -- whether terminal buffer mapping is enabled + tmux = false, -- tmux statusline can be disabled on opening of Lf + default_file_manager = true, -- make lf default file manager + disable_netrw_warning = true, -- don't display a message when opening a directory with `default_file_manager` as true + highlights = { -- highlights passed to toggleterm + Normal = { link = "Normal" }, + NormalFloat = { link = "Normal" }, + FloatBorder = { guifg = "#cdcbe0", guibg = "#191726" }, + }, -- Layout configurations - layout_mapping = "<M-u>"; -- resize window with this key - views = { -- window dimensions to rotate through - { width = 0.800; height = 0.800; }; - { width = 0.600; height = 0.600; }; - { width = 0.950; height = 0.950; }; - { width = 0.500; height = 0.500; col = 0; row = 0; }; - { width = 0.500; height = 0.500; col = 0; row = 0.5; }; - { width = 0.500; height = 0.500; col = 0.5; row = 0; }; - { width = 0.500; height = 0.500; col = 0.5; row = 0.5; }; - }; + layout_mapping = "<M-u>", -- resize window with this key + views = { -- window dimensions to rotate through + { width = 0.800, height = 0.800 }, + { width = 0.600, height = 0.600 }, + { width = 0.950, height = 0.950 }, + { width = 0.500, height = 0.500, col = 0, row = 0 }, + { width = 0.500, height = 0.500, col = 0, row = 0.5 }, + { width = 0.500, height = 0.500, col = 0.5, row = 0 }, + { width = 0.500, height = 0.500, col = 0.5, row = 0.5 }, + }, }) diff --git a/hm/soispha/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua b/hm/soispha/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua index 4273085c..efb15720 100644 --- a/hm/soispha/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua +++ b/hm/soispha/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua @@ -3,12 +3,12 @@ require("lsp-progress").setup({ -- Spinning icons. -- --- @type string[] - spinner = { "⣾"; "⣽"; "⣻"; "⢿"; "⡿"; "⣟"; "⣯"; "⣷"; }; + spinner = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }, -- Spinning update time in milliseconds. -- --- @type integer - spin_update_time = 200; + spin_update_time = 200, -- Last message cached decay time in milliseconds. -- @@ -17,12 +17,12 @@ require("lsp-progress").setup({ -- for a while for user view. -- --- @type integer - decay = 700; + decay = 700, -- User event name. -- --- @type string - event = "LspProgressStatusUpdated"; + event = "LspProgressStatusUpdated", -- Event update time limit in milliseconds. -- @@ -31,12 +31,12 @@ require("lsp-progress").setup({ -- event rate to reduce this cost. -- --- @type integer - event_update_time_limit = 100; + event_update_time_limit = 100, -- Max progress string length, by default -1 is unlimited. -- --- @type integer - max_size = -1; + max_size = -1, -- Regular internal update time. -- @@ -44,7 +44,7 @@ require("lsp-progress").setup({ -- message. -- --- @type integer - regular_internal_update_time = 500; + regular_internal_update_time = 500, -- Disable emitting events on specific mode/filetype. -- User events would interrupt insert mode, thus break which-key like plugins behaviour. @@ -53,7 +53,7 @@ require("lsp-progress").setup({ -- * https://neovim.io/doc/user/builtin.html#mode() -- --- @type table[] - disable_events_opts = { { mode = "i"; filetype = "TelescopePrompt"; }; }; + disable_events_opts = { { mode = "i", filetype = "TelescopePrompt" } }, -- Format series message. -- @@ -89,7 +89,7 @@ require("lsp-progress").setup({ table.insert(builder, "- done") end return table.concat(builder, " ") - end; + end, -- Format client message. -- @@ -107,9 +107,9 @@ require("lsp-progress").setup({ --- `client_messages` array, or ignored if return nil. client_format = function(client_name, spinner, series_messages) return #series_messages > 0 - and ("[" .. client_name .. "] " .. spinner .. " " .. table.concat(series_messages, ", ")) + and ("[" .. client_name .. "] " .. spinner .. " " .. table.concat(series_messages, ", ")) or nil - end; + end, -- Format (final) message. -- @@ -123,22 +123,22 @@ require("lsp-progress").setup({ format = function(client_messages) local sign = " LSP" -- nf-fa-gear \uf013 return #client_messages > 0 and (sign .. " " .. table.concat(client_messages, " ")) or sign - end; + end, -- Enable debug. -- --- @type boolean - debug = false; + debug = false, -- Print log to console(command line). -- --- @type boolean - console_log = false; + console_log = false, -- Print log to file. -- --- @type boolean - file_log = true; + file_log = true, -- Log file to write, work with `file_log=true`. -- @@ -146,5 +146,5 @@ require("lsp-progress").setup({ -- For *NIX: `~/.local/share/nvim/lsp-progress.log`. -- --- @type string - file_log_name = "lsp-progress.log"; + file_log_name = "lsp-progress.log", }) diff --git a/hm/soispha/conf/nvim/plgs/ltex_extra/lua/ltex_extra.lua b/hm/soispha/conf/nvim/plgs/ltex_extra/lua/ltex_extra.lua index 9bcfd33c..f55a9ba7 100644 --- a/hm/soispha/conf/nvim/plgs/ltex_extra/lua/ltex_extra.lua +++ b/hm/soispha/conf/nvim/plgs/ltex_extra/lua/ltex_extra.lua @@ -1,16 +1,16 @@ require("ltex_extra").setup({ -- table <string> : languages for witch dictionaries will be loaded, e.g. { "es-AR", "en-US" } -- https://valentjn.github.io/ltex/supported-languages.html#natural-languages - load_langs = {"en-CA", "de-DE"}; -- en-US as default + load_langs = { "en-CA", "de-DE" }, -- en-US as default -- boolean : whether to load dictionaries on startup - init_check = true; + init_check = true, -- string : relative or absolute path to store dictionaries -- e.g. subfolder in the project root or the current working directory: ".ltex" -- e.g. shared files for all projects: vim.fn.expand("~") .. "/.local/share/ltex" - path = vim.fn.expand("~") .. "/.local/state/nvim/ltex"; -- project root or current working directory + path = vim.fn.expand("~") .. "/.local/state/nvim/ltex", -- project root or current working directory -- string : "none", "trace", "debug", "info", "warn", "error", "fatal" - log_level = "warn"; + log_level = "warn", -- table : configurations of the ltex language server. -- Only if you are calling the server from ltex_extra - server_opts = nil; + server_opts = nil, }) diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/luasnip.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/luasnip.lua index 0a603692..a05fa57f 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/luasnip.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/luasnip.lua @@ -1,7 +1,7 @@ require("luasnip").config.set_config({ -- Enable auto triggered snippets - enable_autosnippets = true; + enable_autosnippets = true, -- Use Tab (or some other key if you prefer) to trigger visual selection - store_selection_keys = "<Tab>"; + store_selection_keys = "<Tab>", }) diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/all.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/all.lua index c98ee7d2..c3f75058 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/all.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/all.lua @@ -1,4 +1,4 @@ -local ls = require("luasnip"); +local ls = require("luasnip") -- auto_pairs {{{ local get_visual = function(args, parent) if #parent.snippet.env.SELECT_RAW > 0 then @@ -29,31 +29,31 @@ local function pair(pair_begin, pair_end, file_types, condition_function) -- file_types = file_types or {}; return s( - { trig = pair_begin; wordTrig = false; snippetType = "autosnippet"; }, - { t({ pair_begin; }); d(1, get_visual); t({ pair_end; }); }, + { trig = pair_begin, wordTrig = false, snippetType = "autosnippet" }, + { t({ pair_begin }), d(1, get_visual), t({ pair_end }) }, { condition = function() - local filetype_check = true; + local filetype_check = true if file_types ~= nil then - filetype_check = file_types[vim.bo.filetype] or false; - end; + filetype_check = file_types[vim.bo.filetype] or false + end return (not condition_function(pair_begin, pair_end)) and filetype_check - end; + end, } ) end local auto_pairs = { - pair("(", ")", nil, char_count_same); - pair("{", "}", nil, char_count_same); - pair("[", "]", nil, char_count_same); - pair("<", ">", { ["rust"] = true; ["tex"] = true; }, char_count_same); - pair("'", "'", nil, even_count); - pair('"', '"', nil, even_count); - pair("`", "`", nil, even_count); + pair("(", ")", nil, char_count_same), + pair("{", "}", nil, char_count_same), + pair("[", "]", nil, char_count_same), + pair("<", ">", { ["rust"] = true, ["tex"] = true }, char_count_same), + pair("'", "'", nil, even_count), + pair('"', '"', nil, even_count), + pair("`", "`", nil, even_count), } -ls.add_snippets("all", auto_pairs, { type = "snippets"; key = "auto_pairs"; }) +ls.add_snippets("all", auto_pairs, { type = "snippets", key = "auto_pairs" }) -- }}} -- todo_comments {{{ @@ -65,34 +65,33 @@ local utils = require("Comment.utils") ---@return table comment_strings {begcstring, endcstring} local get_cstring = function(ctype) -- use the `Comments.nvim` API to fetch the comment string for the region (eq. '--%s' or '--[[%s]]' for `lua`) - local cstring = calculate_comment_string{ ctype = ctype; range = utils.get_region(); } or vim.bo.commentstring + local cstring = calculate_comment_string({ ctype = ctype, range = utils.get_region() }) or vim.bo.commentstring -- as we want only the strings themselves and not strings ready for using `format` we want to split the left and right side local left, right = utils.unwrap_cstr(cstring) -- create a `{left, right}` table for it - return { left; right; } + return { left, right } end _G.luasnip = {} _G.luasnip.vars = { - username = "@soispha"; - email = "soispha@vhack.eu"; + username = "@soispha", + email = "soispha@vhack.eu", } - --- Options for marks to be used in a TODO comment ---@return table,table: The first table contains a node for the date, the second for the signature local marks = { signature = function() return t("(" .. _G.luasnip.vars.username .. ")"), t("") - end; + end, date_signature = function() - return t("<" .. os.date"%Y-%m-%d" .. ">"), t("(" .. _G.luasnip.vars.username .. ")") - end; + return t("<" .. os.date("%Y-%m-%d") .. ">"), t("(" .. _G.luasnip.vars.username .. ")") + end, date = function() - return t("<" .. os.date"%Y-%m-%d" .. ">"), t("") - end; + return t("<" .. os.date("%Y-%m-%d") .. ">"), t("") + end, empty = function() return t(""), t("") - end; + end, } ---@param alias string @@ -100,19 +99,19 @@ local marks = { ---@param mark_function function: This function should return two nodes ---@return table: Returns the comment node local todo_snippet_nodes = function(alias, opts, mark_function) - local date_node, signature_node = mark_function(); + local date_node, signature_node = mark_function() -- format them into the actual snippet local comment_node = fmta("<> <><>: <> <> <>", { f(function() return get_cstring(opts.ctype)[1] -- get <comment-string[1]> - end); - t(alias); -- [name-of-comment] - signature_node; - i(0); -- {comment-text} - date_node; + end), + t(alias), -- [name-of-comment] + signature_node, + i(0), -- {comment-text} + date_node, f(function() return get_cstring(opts.ctype)[2] -- get <comment-string[2]> - end); + end), }) return comment_node end @@ -128,17 +127,13 @@ local todo_snippet = function(context, alias, opts, mark_function) if not context.trig then return error("context doesn't include a `trig` key which is mandatory", 2) -- all we need from the context is the trigger end - opts.ctype = opts.ctype or - 1 -- comment type can be passed in the `opts` table, but if it is not, we have to ensure, it is defined - local alias_string = alias -- `choice_node` documentation - context.name = context.name or - (alias_string .. " comment") -- generate the `name` of the snippet if not defined - context.dscr = context.dscr or - (alias_string .. " comment with a signature-mark") -- generate the `dscr` if not defined - context.docstring = context.docstring or - (" {1:" .. alias_string .. "}: {3} <{2:mark}>{0} ") -- generate the `docstring` if not defined + opts.ctype = opts.ctype or 1 -- comment type can be passed in the `opts` table, but if it is not, we have to ensure, it is defined + local alias_string = alias -- `choice_node` documentation + context.name = context.name or (alias_string .. " comment") -- generate the `name` of the snippet if not defined + context.dscr = context.dscr or (alias_string .. " comment with a signature-mark") -- generate the `dscr` if not defined + context.docstring = context.docstring or (" {1:" .. alias_string .. "}: {3} <{2:mark}>{0} ") -- generate the `docstring` if not defined local comment_node = todo_snippet_nodes(alias, opts, mark_function) - return s(context, comment_node, opts) -- the final todo-snippet constructed from our parameters + return s(context, comment_node, opts) -- the final todo-snippet constructed from our parameters end ---@param context table: The luasnip context @@ -147,39 +142,41 @@ end ---@param marks table: Possible marks to account in snipped generation ---@return table: All possible snippets build from the marks local process_marks = function(context, aliases, opts, marks) - local output = {}; + local output = {} for mark_name, mark_function in pairs(marks) do - local contex_trig_local = context.trig; - context.trig = context.trig .. "-" .. mark_name; - output[#output + 1] = todo_snippet(context, aliases, opts, mark_function); - context.trig = contex_trig_local; + local contex_trig_local = context.trig + context.trig = context.trig .. "-" .. mark_name + output[#output + 1] = todo_snippet(context, aliases, opts, mark_function) + context.trig = contex_trig_local end - return output; + return output end local todo_snippet_specs = { - { { trig = "todo"; }; { "TODO"; }; { ctype = 1; }; }; - { { trig = "fix"; }; { "FIXME"; "ISSUE"; }; { ctype = 1; }; }; - { { trig = "hack"; }; { "HACK"; }; { ctype = 1; }; }; - { { trig = "warn"; }; { "WARNING"; }; { ctype = 1; }; }; - { { trig = "perf"; }; { "PERFORMANCE"; "OPTIMIZE"; }; { ctype = 1; }; }; - { { trig = "note"; }; { "NOTE"; "INFO"; }; { ctype = 1; }; }; + { { trig = "todo" }, { "TODO" }, { ctype = 1 } }, + { { trig = "fix" }, { "FIXME", "ISSUE" }, { ctype = 1 } }, + { { trig = "hack" }, { "HACK" }, { ctype = 1 } }, + { { trig = "warn" }, { "WARNING" }, { ctype = 1 } }, + { { trig = "perf" }, { "PERFORMANCE", "OPTIMIZE" }, { ctype = 1 } }, + { { trig = "note" }, { "NOTE", "INFO" }, { ctype = 1 } }, -- NOTE: Block commented todo-comments - { { trig = "todob"; }; { "TODO"; }; { ctype = 2; }; }; - { { trig = "fixb"; }; { "FIXME"; "ISSUE"; }; { ctype = 2; }; }; - { { trig = "hackb"; }; { "HACK"; }; { ctype = 2; }; }; - { { trig = "warnb"; }; { "WARNING"; }; { ctype = 2; }; }; - { { trig = "perfb"; }; { "PERF"; "PERFORMANCE"; "OPTIM"; "OPTIMIZE"; }; { ctype = 2; }; }; - { { trig = "noteb"; }; { "NOTE"; "INFO"; }; { ctype = 2; }; }; + { { trig = "todob" }, { "TODO" }, { ctype = 2 } }, + { { trig = "fixb" }, { "FIXME", "ISSUE" }, { ctype = 2 } }, + { { trig = "hackb" }, { "HACK" }, { ctype = 2 } }, + { { trig = "warnb" }, { "WARNING" }, { ctype = 2 } }, + { { trig = "perfb" }, { "PERF", "PERFORMANCE", "OPTIM", "OPTIMIZE" }, { ctype = 2 } }, + { { trig = "noteb" }, { "NOTE", "INFO" }, { ctype = 2 } }, } local todo_comment_snippets = {} for _, v in ipairs(todo_snippet_specs) do local snippets = process_marks(v[1], v[2][1], v[3], marks) - for _, value in pairs(snippets) do table.insert(todo_comment_snippets, value) end + for _, value in pairs(snippets) do + table.insert(todo_comment_snippets, value) + end end -ls.add_snippets("all", todo_comment_snippets, { type = "snippets"; key = "todo_comments"; }) +ls.add_snippets("all", todo_comment_snippets, { type = "snippets", key = "todo_comments" }) -- }}} diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua index c467dd68..17e1e7fb 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua @@ -12,10 +12,10 @@ return { -- HEADER s( { - trig = "h([123456])"; - regTrig = true; - wordTrig = false; - snippetType = "autosnippet"; + trig = "h([123456])", + regTrig = true, + wordTrig = false, + snippetType = "autosnippet", }, fmt( [[ @@ -24,50 +24,50 @@ return { { f(function(_, snip) return snip.captures[1] - end); - d(1, get_visual); + end), + d(1, get_visual), f(function(_, snip) return snip.captures[1] - end); + end), } ), - { condition = line_begin; } - ); -- PARAGRAPH + { condition = line_begin } + ), -- PARAGRAPH s( - { trig = "pp"; snippetType = "autosnippet"; }, + { trig = "pp", snippetType = "autosnippet" }, fmt( [[ <p>{}</p> ]], - { d(1, get_visual); } + { d(1, get_visual) } ), - { condition = line_begin; } - ); -- UNORDERED LIST + { condition = line_begin } + ), -- UNORDERED LIST s( - { trig = "itt"; snippetType = "autosnippet"; }, + { trig = "itt", snippetType = "autosnippet" }, fmt( [[ <ul> <li>{}</li>{} </ul> ]], - { i(1); i(0); } + { i(1), i(0) } ), - { condition = line_begin; } - ); -- LIST ITEM + { condition = line_begin } + ), -- LIST ITEM s( - { trig = "ii"; snippetType = "autosnippet"; }, + { trig = "ii", snippetType = "autosnippet" }, fmt( [[ <li>{}</li> ]], - { d(1, get_visual); } + { d(1, get_visual) } ), - { condition = line_begin; } - ); + { condition = line_begin } + ), -- DOCUMENT TEMPLATE s( - { trig = "base"; }, + { trig = "base" }, fmt( [[ <!doctype HTML> @@ -81,16 +81,16 @@ return { </body> </html> ]], - { i(1, "FooBar"); i(0); } + { i(1, "FooBar"), i(0) } ), - { condition = line_begin; } - ); -- ANCHOR TAG + { condition = line_begin } + ), -- ANCHOR TAG s( { - trig = "([^%l])aa"; - regTrig = true; - wordTrig = false; - snippetType = "autosnippet"; + trig = "([^%l])aa", + regTrig = true, + wordTrig = false, + snippetType = "autosnippet", }, fmt( [[ @@ -99,10 +99,10 @@ return { { f(function(_, snip) return snip.captures[1] - end); - i(1); - d(2, get_visual); + end), + i(1), + d(2, get_visual), } ) - ); + ), } diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua index e50898fc..22434aa3 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua @@ -6,29 +6,29 @@ local get_visual = function(args, parent) end end -local translation_table = { ["("] = ")"; ["{"] = "}"; ["["] = "]"; } +local translation_table = { ["("] = ")", ["{"] = "}", ["["] = "]" } -- Return snippet tables return { -- LEFT/RIGHT ALL BRACES s( { - trig = "([^%a])l([%(%[%{])"; - regTrig = true; - wordTrig = false; - snippetType = "autosnippet"; + trig = "([^%a])l([%(%[%{])", + regTrig = true, + wordTrig = false, + snippetType = "autosnippet", }, fmta("<>\\left<><>\\right<>", { f(function(_, snip) return snip.captures[1] - end); + end), f(function(_, snip) return snip.captures[2] - end); - d(1, get_visual); + end), + d(1, get_visual), f(function(_, snip) return translation_table[snip.captures[2]] - end); + end), }) - ); + ), } diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/greek.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/greek.lua index 19989093..ebf4f9d7 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/greek.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/greek.lua @@ -1,37 +1,37 @@ -- Return snippet tables return { - s({ trig = ";a"; snippetType = "autosnippet"; }, { t("\\alpha"); }); - s({ trig = ";b"; snippetType = "autosnippet"; }, { t("\\beta"); }); - s({ trig = ";g"; snippetType = "autosnippet"; }, { t("\\gamma"); }); - s({ trig = ";G"; snippetType = "autosnippet"; }, { t("\\Gamma"); }); - s({ trig = ";d"; snippetType = "autosnippet"; }, { t("\\delta"); }); - s({ trig = ";D"; snippetType = "autosnippet"; }, { t("\\Delta"); }); - s({ trig = ";e"; snippetType = "autosnippet"; }, { t("\\epsilon"); }); - s({ trig = ";ve"; snippetType = "autosnippet"; }, { t("\\varepsilon"); }); - s({ trig = ";z"; snippetType = "autosnippet"; }, { t("\\zeta"); }); - s({ trig = ";h"; snippetType = "autosnippet"; }, { t("\\eta"); }); - s({ trig = ";o"; snippetType = "autosnippet"; }, { t("\\theta"); }); - s({ trig = ";vo"; snippetType = "autosnippet"; }, { t("\\vartheta"); }); - s({ trig = ";O"; snippetType = "autosnippet"; }, { t("\\Theta"); }); - s({ trig = ";k"; snippetType = "autosnippet"; }, { t("\\kappa"); }); - s({ trig = ";l"; snippetType = "autosnippet"; }, { t("\\lambda"); }); - s({ trig = ";L"; snippetType = "autosnippet"; }, { t("\\Lambda"); }); - s({ trig = ";m"; snippetType = "autosnippet"; }, { t("\\mu"); }); - s({ trig = ";n"; snippetType = "autosnippet"; }, { t("\\nu"); }); - s({ trig = ";x"; snippetType = "autosnippet"; }, { t("\\xi"); }); - s({ trig = ";X"; snippetType = "autosnippet"; }, { t("\\Xi"); }); - s({ trig = ";i"; snippetType = "autosnippet"; }, { t("\\pi"); }); - s({ trig = ";I"; snippetType = "autosnippet"; }, { t("\\Pi"); }); - s({ trig = ";r"; snippetType = "autosnippet"; }, { t("\\rho"); }); - s({ trig = ";s"; snippetType = "autosnippet"; }, { t("\\sigma"); }); - s({ trig = ";S"; snippetType = "autosnippet"; }, { t("\\Sigma"); }); - s({ trig = ";t"; snippetType = "autosnippet"; }, { t("\\tau"); }); - s({ trig = ";f"; snippetType = "autosnippet"; }, { t("\\phi"); }); - s({ trig = ";vf"; snippetType = "autosnippet"; }, { t("\\varphi"); }); - s({ trig = ";F"; snippetType = "autosnippet"; }, { t("\\Phi"); }); - s({ trig = ";c"; snippetType = "autosnippet"; }, { t("\\chi"); }); - s({ trig = ";p"; snippetType = "autosnippet"; }, { t("\\psi"); }); - s({ trig = ";P"; snippetType = "autosnippet"; }, { t("\\Psi"); }); - s({ trig = ";w"; snippetType = "autosnippet"; }, { t("\\omega"); }); - s({ trig = ";W"; snippetType = "autosnippet"; }, { t("\\Omega"); }); + s({ trig = ";a", snippetType = "autosnippet" }, { t("\\alpha") }), + s({ trig = ";b", snippetType = "autosnippet" }, { t("\\beta") }), + s({ trig = ";g", snippetType = "autosnippet" }, { t("\\gamma") }), + s({ trig = ";G", snippetType = "autosnippet" }, { t("\\Gamma") }), + s({ trig = ";d", snippetType = "autosnippet" }, { t("\\delta") }), + s({ trig = ";D", snippetType = "autosnippet" }, { t("\\Delta") }), + s({ trig = ";e", snippetType = "autosnippet" }, { t("\\epsilon") }), + s({ trig = ";ve", snippetType = "autosnippet" }, { t("\\varepsilon") }), + s({ trig = ";z", snippetType = "autosnippet" }, { t("\\zeta") }), + s({ trig = ";h", snippetType = "autosnippet" }, { t("\\eta") }), + s({ trig = ";o", snippetType = "autosnippet" }, { t("\\theta") }), + s({ trig = ";vo", snippetType = "autosnippet" }, { t("\\vartheta") }), + s({ trig = ";O", snippetType = "autosnippet" }, { t("\\Theta") }), + s({ trig = ";k", snippetType = "autosnippet" }, { t("\\kappa") }), + s({ trig = ";l", snippetType = "autosnippet" }, { t("\\lambda") }), + s({ trig = ";L", snippetType = "autosnippet" }, { t("\\Lambda") }), + s({ trig = ";m", snippetType = "autosnippet" }, { t("\\mu") }), + s({ trig = ";n", snippetType = "autosnippet" }, { t("\\nu") }), + s({ trig = ";x", snippetType = "autosnippet" }, { t("\\xi") }), + s({ trig = ";X", snippetType = "autosnippet" }, { t("\\Xi") }), + s({ trig = ";i", snippetType = "autosnippet" }, { t("\\pi") }), + s({ trig = ";I", snippetType = "autosnippet" }, { t("\\Pi") }), + s({ trig = ";r", snippetType = "autosnippet" }, { t("\\rho") }), + s({ trig = ";s", snippetType = "autosnippet" }, { t("\\sigma") }), + s({ trig = ";S", snippetType = "autosnippet" }, { t("\\Sigma") }), + s({ trig = ";t", snippetType = "autosnippet" }, { t("\\tau") }), + s({ trig = ";f", snippetType = "autosnippet" }, { t("\\phi") }), + s({ trig = ";vf", snippetType = "autosnippet" }, { t("\\varphi") }), + s({ trig = ";F", snippetType = "autosnippet" }, { t("\\Phi") }), + s({ trig = ";c", snippetType = "autosnippet" }, { t("\\chi") }), + s({ trig = ";p", snippetType = "autosnippet" }, { t("\\psi") }), + s({ trig = ";P", snippetType = "autosnippet" }, { t("\\Psi") }), + s({ trig = ";w", snippetType = "autosnippet" }, { t("\\omega") }), + s({ trig = ";W", snippetType = "autosnippet" }, { t("\\Omega") }), } diff --git a/hm/soispha/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua b/hm/soispha/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua index c6cd1420..4ed49f7b 100644 --- a/hm/soispha/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua +++ b/hm/soispha/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua @@ -1,6 +1,6 @@ require("lint").linters_by_ft = { -- text - markdown = {}; + markdown = {}, -- tex = {'chktex'}, -- maybe add some text linters ? -- shell (already covered by the bash language sever) @@ -9,12 +9,12 @@ require("lint").linters_by_ft = { -- zsh = { "shellcheck"; }; -- dash = { "shellcheck"; }; - yaml = { "yamllint"; }; - nix = { "nix"; "statix"; }; + yaml = { "yamllint" }, + nix = { "nix", "statix" }, } -vim.api.nvim_create_autocmd({ "BufEnter"; "BufWritePost"; }, { +vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, { callback = function() require("lint").try_lint() - end; + end, }) diff --git a/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua b/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua index eaf68ecf..7235c5a3 100644 --- a/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua +++ b/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua @@ -11,7 +11,7 @@ if not has_plenary then return end -local log = plenary.log.new({ plugin = "telescope_rooter"; level = "info"; }) +local log = plenary.log.new({ plugin = "telescope_rooter", level = "info" }) -- TODO: expose this function local toggle = function(_) @@ -19,19 +19,19 @@ local toggle = function(_) print("Telescope#rooter#enabled=" .. vim.inspect(vim.g["Telescope#rooter#enabled"])) end -local config = { patterns = { ".git"; }; enable = true; debug = false; } +local config = { patterns = { ".git" }, enable = true, debug = false } -- default enabled vim.g["Telescope#rooter#enabled"] = vim.F.if_nil(config.enable, true) -- redefine log if debug enabled if vim.F.if_nil(config.debug, false) then - log = plenary.log.new({ plugin = "telescope_rooter"; level = "debug"; }) + log = plenary.log.new({ plugin = "telescope_rooter", level = "debug" }) end -local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true; }) +local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true }) -vim.api.nvim_create_autocmd({ "DirChangedPre"; }, { +vim.api.nvim_create_autocmd({ "DirChangedPre" }, { callback = function() if vim.g["Telescope#rooter#enabled"] ~= true then return @@ -41,11 +41,11 @@ vim.api.nvim_create_autocmd({ "DirChangedPre"; }, { vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd() log.debug("before " .. vim.inspect(vim.loop.cwd())) end - end; - group = group; + end, + group = group, }) -vim.api.nvim_create_autocmd({ "BufEnter"; "BufWinEnter"; }, { +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { callback = function() if vim.g["Telescope#rooter#enabled"] ~= true then return @@ -53,18 +53,18 @@ vim.api.nvim_create_autocmd({ "BufEnter"; "BufWinEnter"; }, { vim.schedule(function() if vim.bo.filetype == "TelescopePrompt" then - local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true; })[1]) + local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true })[1]) if rootdir ~= nil then vim.api.nvim_set_current_dir(rootdir) log.debug("changing dir to " .. rootdir) end end end) - end; - group = group; + end, + group = group, }) -vim.api.nvim_create_autocmd({ "BufWinLeave"; }, { +vim.api.nvim_create_autocmd({ "BufWinLeave" }, { callback = function() if vim.g["Telescope#rooter#enabled"] ~= true then return @@ -79,6 +79,6 @@ vim.api.nvim_create_autocmd({ "BufWinLeave"; }, { end end end) - end; - group = group; + end, + group = group, }) diff --git a/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh b/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh index 9ac1ab91..6f09a7e6 100755 --- a/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh +++ b/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh @@ -6,37 +6,36 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH # override shell lib output to stdout eprint() { # shellcheck disable=SC2317 - print "$@"; -}; + print "$@" +} eprintln() { # shellcheck disable=SC2317 - println "$@"; -}; + println "$@" +} enable_hook_dbg() { - debug_hooks="$(task _get rc.debug.hooks)"; + debug_hooks="$(task _get rc.debug.hooks)" [ "$debug_hooks" ] && [ "$debug_hooks" -ge 1 ] && dbg_enable } enforce_project() { - project="$(jq '.project' "$(ptmp "$1")")"; + project="$(jq '.project' "$(ptmp "$1")")" [ "$project" = "null" ] && die "No project supplied!" if grep -q "^$(echo "$project" | sed 's|"\(.*\)"|\1|')\$" "$(ptmp "%PROJECTS_NEWLINE")"; then - dbg "project('$project') is a valid part of %PROJECTS_COMMA"; + dbg "project('$project') is a valid part of %PROJECTS_COMMA" else - die "The project '$(echo "$project" | sed 's|"||g')' is not registered with the nix config, registered projects: %PROJECTS_COMMA"; + die "The project '$(echo "$project" | sed 's|"||g')' is not registered with the nix config, registered projects: %PROJECTS_COMMA" fi } - -read -r new_task; +read -r new_task # We don't change the task, thus immediately return the json -echo "$new_task"; +echo "$new_task" -enable_hook_dbg; -enforce_project "$new_task"; +enable_hook_dbg +enforce_project "$new_task" -exit 0; +exit 0 # vim: ft=sh diff --git a/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_sync-git-repo.sh b/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_sync-git-repo.sh index 8a776d3a..085115e7 100755 --- a/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_sync-git-repo.sh +++ b/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_sync-git-repo.sh @@ -6,38 +6,37 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH # override shell lib output to stdout eprint() { # shellcheck disable=SC2317 - print "$@"; -}; + print "$@" +} eprintln() { # shellcheck disable=SC2317 - println "$@"; -}; + println "$@" +} enable_hook_dbg() { - debug_hooks="$(task _get rc.debug.hooks)"; + debug_hooks="$(task _get rc.debug.hooks)" [ "$debug_hooks" ] && [ "$debug_hooks" -ge 1 ] && dbg_enable } update_git_repo() { - task_data="$(task _get rc.data.location)"; + task_data="$(task _get rc.data.location)" [ "$task_data" ] || die "Taskwarrior should have a location set" cd "$task_data" || die "(BUG?): Your data.location path is not accessable" [ -d ./.git/ ] || git init - git add .; - git commit --message="chore: Update" --no-gpg-sign; + git add . + git commit --message="chore: Update" --no-gpg-sign } - -read -r new_task; +read -r new_task # We don't change the task, thus immediately return the json -echo "$new_task"; +echo "$new_task" -enable_hook_dbg; -update_git_repo; +enable_hook_dbg +update_git_repo -exit 0; +exit 0 # vim: ft=sh diff --git a/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_sync-git-repo.sh b/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_sync-git-repo.sh index b043f141..996e105a 100755 --- a/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_sync-git-repo.sh +++ b/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_sync-git-repo.sh @@ -6,39 +6,38 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH # override shell lib output to stdout eprint() { # shellcheck disable=SC2317 - print "$@"; -}; + print "$@" +} eprintln() { # shellcheck disable=SC2317 - println "$@"; -}; + println "$@" +} enable_hook_dbg() { - debug_hooks="$(task _get rc.debug.hooks)"; + debug_hooks="$(task _get rc.debug.hooks)" [ "$debug_hooks" ] && [ "$debug_hooks" -ge 1 ] && dbg_enable } update_git_repo() { - task_data="$(task _get rc.data.location)"; + task_data="$(task _get rc.data.location)" [ "$task_data" ] || die "Taskwarrior should have a location set" cd "$task_data" || die "(BUG?): Your data.location path is not accessable" [ -d ./.git/ ] || git init - git add .; - git commit --message="chore: Update" --no-gpg-sign; + git add . + git commit --message="chore: Update" --no-gpg-sign } - -read -r _old_task; -read -r new_task; +read -r _old_task +read -r new_task # We don't change the task, thus immediately return the json -echo "$new_task"; +echo "$new_task" -enable_hook_dbg; -update_git_repo; +enable_hook_dbg +update_git_repo -exit 0; +exit 0 # vim: ft=sh diff --git a/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_track-timewarrior.py b/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_track-timewarrior.py index 03b4ce42..c8efb596 100755 --- a/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_track-timewarrior.py +++ b/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_track-timewarrior.py @@ -70,12 +70,17 @@ combined = " ".join(["'%s'" % tag for tag in tags]).encode("utf-8").strip() # Task has been started. if "start" in new and not "start" in old: # Prevent this task from starting if "task +ACTIVE count" is greater than "MAX_ACTIVE". - p = subprocess.Popen(["task", "+ACTIVE", "status:pending", "count", "rc.verbose:off"], stdout=subprocess.PIPE) + p = subprocess.Popen( + ["task", "+ACTIVE", "status:pending", "count", "rc.verbose:off"], + stdout=subprocess.PIPE, + ) out, err = p.communicate() count = int(out.rstrip()) if count >= MAX_ACTIVE: - print("Only %d task(s) can be active at a time. " - "See 'max_active_tasks' in .taskrc." % MAX_ACTIVE) + print( + "Only %d task(s) can be active at a time. " + "See 'max_active_tasks' in .taskrc." % MAX_ACTIVE + ) sys.exit(1) system("timew start " + combined.decode() + " :yes") diff --git a/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_track-total-active-time.py b/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_track-total-active-time.py index 88234cbf..d5b380d0 100755 --- a/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_track-total-active-time.py +++ b/hm/soispha/conf/taskwarrior/hooks/scripts/on-modify_track-total-active-time.py @@ -102,12 +102,17 @@ def main(): # An active task has just been started. if "start" in modified and "start" not in original: # Prevent this task from starting if "task +ACTIVE count" is greater than "MAX_ACTIVE". - p = subprocess.Popen(["task", "+ACTIVE", "status:pending", "count", "rc.verbose:off"], stdout=subprocess.PIPE) + p = subprocess.Popen( + ["task", "+ACTIVE", "status:pending", "count", "rc.verbose:off"], + stdout=subprocess.PIPE, + ) out, err = p.communicate() count = int(out.rstrip()) if count >= MAX_ACTIVE: - print("Only %d task(s) can be active at a time. " - "See 'max_active_tasks' in .taskrc." % MAX_ACTIVE) + print( + "Only %d task(s) can be active at a time. " + "See 'max_active_tasks' in .taskrc." % MAX_ACTIVE + ) sys.exit(1) # An active task has just been stopped. @@ -119,10 +124,18 @@ def main(): if UDA_KEY not in modified: modified[UDA_KEY] = 0 - this_duration = (end - start) - total_duration = (this_duration + duration_str_to_time_delta(str(modified[UDA_KEY]))) - print("Total Time Tracked: %s (%s in this instance)" % (total_duration, this_duration)) - modified[UDA_KEY] = str(int(total_duration.days * (60 * 60 * 24) + total_duration.seconds)) + "seconds" + this_duration = end - start + total_duration = this_duration + duration_str_to_time_delta( + str(modified[UDA_KEY]) + ) + print( + "Total Time Tracked: %s (%s in this instance)" + % (total_duration, this_duration) + ) + modified[UDA_KEY] = ( + str(int(total_duration.days * (60 * 60 * 24) + total_duration.seconds)) + + "seconds" + ) return json.dumps(modified, separators=(",", ":")) diff --git a/hm/soispha/conf/xdg/url_handler.sh b/hm/soispha/conf/xdg/url_handler.sh index 9cca2fc0..53ae4986 100755 --- a/hm/soispha/conf/xdg/url_handler.sh +++ b/hm/soispha/conf/xdg/url_handler.sh @@ -3,18 +3,16 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -project="$(echo "%ALL_PROJECTS_PIPE|nvim|zathura|" | rofi -sep "|" -dmenu)"; +project="$(echo "%ALL_PROJECTS_PIPE|nvim|zathura|" | rofi -sep "|" -dmenu)" if [ "$project" = "nvim" ]; then "$TERMINAL" -e nvim "$1" elif [ "$project" = "zathura" ]; then zathura "$1" elif [ "$project" ]; then - firefox -P "$project" "$1"; + firefox -P "$project" "$1" else notify-send "(URL HANDLER) No project selected" && exit 1 fi - # vim: ft=sh diff --git a/hm/soispha/conf/yambar/scripts/disk.sh b/hm/soispha/conf/yambar/scripts/disk.sh index 003455ab..284661b9 100755 --- a/hm/soispha/conf/yambar/scripts/disk.sh +++ b/hm/soispha/conf/yambar/scripts/disk.sh @@ -5,18 +5,17 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH # Main loop while true; do - # vars - used_space=$(btrfs filesystem usage /srv 2> /dev/null | awk '{if ( /Used:/ ) { print $2 } } ' | head -n1) - all_space=$(btrfs filesystem usage /srv 2> /dev/null | awk '{if ( /Device size:/ ) { print $3 } } ' | head -n1 | tr -d "GiB") + # vars + used_space=$(btrfs filesystem usage /srv 2>/dev/null | awk '{if ( /Used:/ ) { print $2 } } ' | head -n1) + all_space=$(btrfs filesystem usage /srv 2>/dev/null | awk '{if ( /Device size:/ ) { print $3 } } ' | head -n1 | tr -d "GiB") + # Check space available (4) and percentage used (5) + spaceperc=$(echo "$(echo "$used_space" | tr -d "GiB")" "$all_space" | awk '{div=$1/$2;div *= 100; printf"%2d%%\n",div }') - # Check space available (4) and percentage used (5) - spaceperc=$(echo "$(echo "$used_space" | tr -d "GiB" )" "$all_space" | awk '{div=$1/$2;div *= 100; printf"%2d%%\n",div }') - - echo "diskspace|string|$used_space" - echo "diskperc|string|$spaceperc" - echo "" - sleep 1 + echo "diskspace|string|$used_space" + echo "diskperc|string|$spaceperc" + echo "" + sleep 1 done # vim: ft=sh diff --git a/hm/soispha/conf/yambar/scripts/grades-average.sh b/hm/soispha/conf/yambar/scripts/grades-average.sh index 8c1900cf..b93869c5 100755 --- a/hm/soispha/conf/yambar/scripts/grades-average.sh +++ b/hm/soispha/conf/yambar/scripts/grades-average.sh @@ -4,12 +4,12 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH while true; do - grade="$(grades list average | awk '{print $2}')"; + grade="$(grades list average | awk '{print $2}')" - echo "grade|string|$grade"; - echo ""; + echo "grade|string|$grade" + echo "" - sleep 1; + sleep 1 done # vim: ft=sh diff --git a/hm/soispha/conf/yambar/scripts/mpd_song_name.sh b/hm/soispha/conf/yambar/scripts/mpd_song_name.sh index b778afbc..b251619b 100755 --- a/hm/soispha/conf/yambar/scripts/mpd_song_name.sh +++ b/hm/soispha/conf/yambar/scripts/mpd_song_name.sh @@ -3,12 +3,11 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - while true; do - state="$(mpc status '%state%')"; + state="$(mpc status '%state%')" if [ "$state" = "playing" ]; then - song="$(mpc --format '[[%artist% - ]%title%]|[%file%]' current)"; + song="$(mpc --format '[[%artist% - ]%title%]|[%file%]' current)" echo "playing|bool|true" echo "song|string|$song" else @@ -16,7 +15,7 @@ while true; do fi echo "" # commit - sleep 2; + sleep 2 done # vim: ft=sh diff --git a/hm/soispha/conf/yambar/scripts/network.sh b/hm/soispha/conf/yambar/scripts/network.sh index 717ea6be..b4396640 100755 --- a/hm/soispha/conf/yambar/scripts/network.sh +++ b/hm/soispha/conf/yambar/scripts/network.sh @@ -8,40 +8,40 @@ retest_if_con_fails=10 backend=nmcli case "$backend" in - "nmcli") # Test for connectivity with nmcli - while true; do - connection_status=$(nmcli networking connectivity) - if [ "$connection_status" = "full" ]; then - echo "internet|string|Connected" - echo "" - sleep $retest - else - echo "internet|string|Disconnected" - echo "" - sleep $retest_if_con_fails - fi - done - ;; - "ping") # Test for connectivity with ping - ip_address='8.8.8.8' - ping_number=3 +"nmcli") # Test for connectivity with nmcli + while true; do + connection_status=$(nmcli networking connectivity) + if [ "$connection_status" = "full" ]; then + echo "internet|string|Connected" + echo "" + sleep $retest + else + echo "internet|string|Disconnected" + echo "" + sleep $retest_if_con_fails + fi + done + ;; +"ping") # Test for connectivity with ping + ip_address='8.8.8.8' + ping_number=3 - while true; do + while true; do - ping_result=$(mktmp) - ping $ip_address -c $ping_number -q | awk 'BEGIN {FS="/"} END {print $5}' > "$ping_result" + ping_result=$(mktmp) + ping $ip_address -c $ping_number -q | awk 'BEGIN {FS="/"} END {print $5}' >"$ping_result" - if [ "$(cat "$ping_result" | wc -l)" -eq 0 ]; then - echo "med|string|No connection" - echo "" - sleep $retest_if_con_fails - else - echo "med|string|$(cat "$ping_result") ms" - echo "" - sleep $retest - fi - done - ;; + if [ "$(wc -l <"$ping_result")" -eq 0 ]; then + echo "med|string|No connection" + echo "" + sleep $retest_if_con_fails + else + echo "med|string|$(cat "$ping_result") ms" + echo "" + sleep $retest + fi + done + ;; esac # vim: ft=sh diff --git a/hm/soispha/conf/yambar/scripts/old/amixer-monitor.sh b/hm/soispha/conf/yambar/scripts/old/amixer-monitor.sh deleted file mode 100755 index 9e75acfa..00000000 --- a/hm/soispha/conf/yambar/scripts/old/amixer-monitor.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# An improved amixer script that actually detects volume beyond 100% - - -SLEEPTIME=1 - - -while true; do - - volume=$(pactl get-sink-volume 0 | awk 'BEGIN { FS="/"} {print $2 }' | tr -d "%" | tr -d ' ') - - if [ "$volume" -eq 0 ]; then - echo "muted|bool|true" - - else - # Read sink volume in percentages - echo "volume|string|$volume" - echo "muted|bool|false" - fi - - echo "" - sleep "$SLEEPTIME" - -done diff --git a/hm/soispha/conf/yambar/scripts/old/cpu.sh b/hm/soispha/conf/yambar/scripts/old/cpu.sh deleted file mode 100755 index bae820d0..00000000 --- a/hm/soispha/conf/yambar/scripts/old/cpu.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -# I didn't write this script; this is almost directly copied from the dnkl/yambar github. - - -# cpu.sh - measures CPU usage at a configurable sample interval -# -# Usage: cpu.sh INTERVAL_IN_SECONDS -# -# This script will emit the following tags on stdout (N is the number -# of logical CPUs): -# -# Name Type -# -------------------- -# cpu range 0-100 -# cpu0 range 0-100 -# cpu1 range 0-100 -# ... -# cpuN-1 range 0-100 -# -# I.e. ‘cpu’ is the average (or aggregated) CPU usage, while cpuX is a -# specific CPU’s usage. -# -# Example configuration (update every second): -# -# - script: -# path: /path/to/cpu.sh -# args: [1] -# content: {string: {text: "{cpu}%"}} -# - -interval=2 - -case ${interval} in - ''|*[!0-9]*) - echo "interval must be an integer" - exit 1 - ;; - *) - ;; -esac - -# Get number of CPUs, by reading /proc/stat -# The output looks like: -# -# cpu A B C D ... -# cpu0 A B C D ... -# cpu1 A B C D ... -# cpuN A B C D ... -# -# The first line is a summary line, accounting *all* CPUs -IFS=$'\n' readarray -t all_cpu_stats < <(grep -e "^cpu" /proc/stat) -cpu_count=$((${#all_cpu_stats[@]} - 1)) - -# Arrays of ‘previous’ idle and total stats, needed to calculate the -# difference between each sample. -prev_idle=() -prev_total=() -for i in $(seq ${cpu_count}); do - prev_idle+=(0) - prev_total+=(0) -done - -prev_average_idle=0 -prev_average_total=0 - -while true; do - IFS=$'\n' readarray -t all_cpu_stats < <(grep -e "^cpu" /proc/stat) - - usage=() # CPU usage in percent, 0 <= x <= 100 - - average_idle=0 # All CPUs idle time since boot - average_total=0 # All CPUs total time since boot - - for i in $(seq 0 $((cpu_count - 1))); do - # Split this CPUs stats into an array - stats=($(echo "${all_cpu_stats[$((i + 1))]}")) - - # man procfs(5) - user=${stats[1]} - nice=${stats[2]} - system=${stats[3]} - idle=${stats[4]} - iowait=${stats[5]} - irq=${stats[6]} - softirq=${stats[7]} - steal=${stats[8]} - guest=${stats[9]} - guestnice=${stats[10]} - - # Guest time already accounted for in user - user=$((user - guest)) - nice=$((nice - guestnice)) - - idle=$((idle + iowait)) - - total=$((user + nice + system + irq + softirq + idle + steal + guest + guestnice)) - - average_idle=$((average_idle + idle)) - average_total=$((average_total + total)) - - # Diff since last sample - diff_idle=$((idle - prev_idle[i])) - diff_total=$((total - prev_total[i])) - - usage[i]=$((100 * (diff_total - diff_idle) / diff_total)) - - prev_idle[i]=${idle} - prev_total[i]=${total} - done - - diff_average_idle=$((average_idle - prev_average_idle)) - diff_average_total=$((average_total - prev_average_total)) - - average_usage=$((100 * (diff_average_total - diff_average_idle) / diff_average_total)) - - prev_average_idle=${average_idle} - prev_average_total=${average_total} - - echo "cpu|range:0-100|${average_usage}" - for i in $(seq 0 $((cpu_count - 1))); do - echo "cpu${i}|range:0-100|${usage[i]}" - done - - echo "" - sleep "${interval}" -done diff --git a/hm/soispha/conf/yambar/scripts/old/dfspace.sh b/hm/soispha/conf/yambar/scripts/old/dfspace.sh deleted file mode 100755 index 0b262481..00000000 --- a/hm/soispha/conf/yambar/scripts/old/dfspace.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# Sleep seconds -timer="60" - -# Main loop -while true; do - - # vars - used_space=$(btrfs filesystem usage / 2> /dev/null | awk '{if ( /Used:/ ) { print $2 } } ' | head -n1) - all_space=$(btrfs filesystem usage / 2> /dev/null | awk '{if ( /Device size:/ ) { print $3 } } ' | head -n1 | tr -d "GiB") - - - # Check space available (4) and percentage used (5) - spaceperc=$(echo "$(echo "$used_space" | tr -d "GiB" )" "$all_space" | awk '{div=$1/$2;div *= 100; printf"%2d%%\n",div }') - - echo "diskspace|string|$used_space" - echo "diskperc|string|$spaceperc" - echo "" - sleep $timer - -done - diff --git a/hm/soispha/conf/yambar/scripts/old/grades-average.sh b/hm/soispha/conf/yambar/scripts/old/grades-average.sh deleted file mode 100755 index a04b958c..00000000 --- a/hm/soispha/conf/yambar/scripts/old/grades-average.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# shellcheck disable=SC2086 -# shellcheck source=/dev/null -. ~/.local/lib/shell/lib - -grade=$(grades list average | awk '{print $2}'); - -echo "grade|string|$grade"; -echo ""; - - -if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/hm/soispha/conf/yambar/scripts/old/meminfo.sh b/hm/soispha/conf/yambar/scripts/old/meminfo.sh deleted file mode 100755 index 0156e94c..00000000 --- a/hm/soispha/conf/yambar/scripts/old/meminfo.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# Checks memory usage - -# Number of seconds to retest -timer=5 - -# Main loop -while true; do - - mem_total=$(LANG=C free -b|awk '/^Mem:/{print $2}') - mem_used=$(LANG=C free -b|awk '/^Mem:/{print $3}') - swap_total=$(LANG=C free -b|awk '/^Swap:/{print $2}') - swap_used=$(LANG=C free -b|awk '/^Swap:/{print $3}') - - - memperc=$(echo "$mem_used" "$mem_total" | awk '{ div = 100 * ($1 / $2)} { printf "%.0f ", div }' | tr -d ' ' ) - swapperc=$(echo "$swap_used" "$swap_total" | awk '{ - if ( $1 == 0 || $2 == 0 ) { - print "%" - } else { - div = 100 * ($1 / $2); - printf "%.0f ", div -} -}' | tr -d ' ' ) - - -echo "memperc|string|$memperc" -if [ "$swapperc" = "%" ];then - echo "swapstate|bool|false" -else - echo "swapperc|string|$swapperc" - echo "swapstate|bool|true" -fi -echo "" -sleep "$timer" - -done diff --git a/hm/soispha/conf/yambar/scripts/old/nmclitest.sh b/hm/soispha/conf/yambar/scripts/old/nmclitest.sh deleted file mode 100755 index 3e8bc73a..00000000 --- a/hm/soispha/conf/yambar/scripts/old/nmclitest.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Test for connectivity with nmcli - -Timer=${1:-120} # Number of seconds to retest -Timer2=${2:-10} # Number of seconds to retest if connection fails - -# Main loop -while true; do - - CONN=$(nmcli networking connectivity) - - if [[ "$CONN" == "full" ]]; then - echo "internet|string|Connected" - echo "" - sleep $Timer - else - echo "internet|string|Disconnected" - echo "" - sleep $Timer2 - fi - -done - diff --git a/hm/soispha/conf/yambar/scripts/old/pingtest.sh b/hm/soispha/conf/yambar/scripts/old/pingtest.sh deleted file mode 100755 index 2b5f9998..00000000 --- a/hm/soispha/conf/yambar/scripts/old/pingtest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# Test for connectivity with ping - -Timer=${1:-120} # Number of seconds to retest -Timer2=${2:-10} # Number of seconds to retest if connection fails -IP=${3:-'8.8.8.8'} # IP address to test, defaults to Google -PCount=${4:-3} # Number of pings to send - -# Main loop -while true; do - - # Pings the IP address for five times - PINGSTR=$(ping $IP -c $PCount -q) - # Use text formatting to get min/max ms delays - MED=$(echo $PINGSTR | sed 's/min\/avg\/max\/mdev = /\n/g' | tail -n 1 | sed 's/\//\t/g' | cut -f2) - - if [[ "$MED" == "" ]]; then - echo "med|string|No connection" - echo "" - sleep $Timer2 - else - echo "med|string|$MED ms" - echo "" - sleep $Timer - fi - -done - diff --git a/hm/soispha/conf/yambar/scripts/old/yambar-tray-width.sh b/hm/soispha/conf/yambar/scripts/old/yambar-tray-width.sh deleted file mode 100755 index 00544e70..00000000 --- a/hm/soispha/conf/yambar/scripts/old/yambar-tray-width.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# shellcheck disable=SC2086 -# shellcheck source=/dev/null -. ~/.local/lib/shell/lib - - -CHARWIDTH=8 # i guess? - -tray_width_px() { - xwininfo -name panel | # trayer names its window "panel" - grep -i width: | - awk '{print $2}' -} - -px_to_spaces() { - spaces="$((1 + ${1:-0} / $CHARWIDTH))" - printf "% *s\n" $spaces -} - -sleep 0.2 # be sure trayer is already up - -output="$(px_to_spaces `tray_width_px`)" -echo "padding|string|$output" -echo "" - - - -if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/hm/soispha/conf/yambar/scripts/old/yambar-tray.sh b/hm/soispha/conf/yambar/scripts/old/yambar-tray.sh deleted file mode 100755 index 1704c6dd..00000000 --- a/hm/soispha/conf/yambar/scripts/old/yambar-tray.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - - -pkill stalonetray -pkill trayer - -# launch a tray. -echo - -sleep 0.1 # make sure yambar starts first so we can draw on tpo of it - -# trayer-srg fork! -trayer \ - --edge top \ - --tint 0x24242400 \ - --align right \ - --height 20 \ - --expand false \ - --transparent true \ - --alpha 0 \ - --width 20 \ - --monitor primary \ - --widthtype request - # &>/dev/null - - - diff --git a/hm/soispha/conf/yambar/scripts/sound-volume.sh b/hm/soispha/conf/yambar/scripts/sound-volume.sh index 721d51bf..f887b4de 100755 --- a/hm/soispha/conf/yambar/scripts/sound-volume.sh +++ b/hm/soispha/conf/yambar/scripts/sound-volume.sh @@ -14,7 +14,7 @@ while true; do fi echo "" - sleep 3; + sleep 3 done # vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/apps/aumo.sh b/hm/soispha/pkgs/scripts/apps/aumo.sh index b5840fc3..7426115a 100755 --- a/hm/soispha/pkgs/scripts/apps/aumo.sh +++ b/hm/soispha/pkgs/scripts/apps/aumo.sh @@ -3,52 +3,23 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH -# TODO: rewrite this - -if [ "$1" = "-u" ];then udisksctl unmount -b "$(cat "$HOME/.cache/aumo/mnt_disk")"; exit 0; fi -all_available_disks=$(mktemp) -awk '{print $4}' /proc/partitions | sed '1 s|.*||' > "$all_available_disks" - -mounted_disk=$(mktemp) -awk '{print $1}' /proc/mounts > "$mounted_disk" - -unmounted_disks=$(mktemp) - -for i in $(cat $all_available_disks);do - if ! grep -qw "/dev/$i" $mounted_disk && ! ls /sys/block/$i/*/partition > /dev/null 2> /dev/null;then echo $i >> $unmounted_disks;fi -done - - -u=1 -disk=-1 -while [ $disk -lt 0 ] || [ $disk -gt $(wc -l $unmounted_disks | awk '{print $1}') ];do - - [ "$1" = "-v" ] && for i in $(cat $unmounted_disks);do - sudo fdisk -l "/dev/$i" - done - - for i in $(cat $unmounted_disks);do - printf "%4s) %s\n" "$u" "$i" - u=$(( u + 1 )) - done - - printf "%4s) Exit\n" "0" - printf "Input number: " - read -r disk - - [ $disk -lt 0 ] || [ $disk -gt $(wc -l $unmounted_disks | awk '{print $1}') ] && printf "Wrong number. Please retry\n" - [ $disk -eq 0 ] && exit 0 -done - -mnt_disk="/dev/$(awk -v n=$disk 'NR==n' $unmounted_disks)" - -if ! [ "$1" = "-v" ] && [ -n "$1" ];then sudo mount "$mnt_disk" "$1" && exit 0;fi -[ -n "$2" ] && sudo mount "$mnt_disk" "$1" && exit 0 -if mount | grep -q ~/mnt ;then dien "Something is mounted at ~/mnt";else udisksctl mount -b "$mnt_disk";fi - -[ -e $HOME/.cache/aumo/mnt_disk ] || mkdir -p $HOME/.cache/aumo -echo $mnt_disk >> $HOME/.cache/aumo/mnt_disk -rm $all_available_disks -rm $mounted_disk -rm $unmounted_disks -[ -d /tmp/LIB_FILE_TEMP_DIR/ ] && rm -r /tmp/LIB_FILE_TEMP_DIR/ +unmounting() { + disk_name="$(find /dev/disk/by-label -type l -printf "%P|" | rofi -sep "|" -dmenu -p "Select disk to mount")" + + udisksctl unmount --block-device "/dev/disk/by-label/$disk_name" +} + +mounting() { + disk_name="$(find /dev/disk/by-label -type l -printf "%P|" | rofi -sep "|" -dmenu -p "Select disk to mount")" + + udisksctl mount --block-device "/dev/disk/by-label/$disk_name" +} + +case "$1" in +"mount") + mounting + ;; +"unmount" | "umount") + unmounting + ;; +esac diff --git a/hm/soispha/pkgs/scripts/apps/con2pdf.sh b/hm/soispha/pkgs/scripts/apps/con2pdf.sh index be8810bb..620a299a 100755 --- a/hm/soispha/pkgs/scripts/apps/con2pdf.sh +++ b/hm/soispha/pkgs/scripts/apps/con2pdf.sh @@ -3,17 +3,19 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - # needed for help() and version # shellcheck disable=2034 -AUTHORS="Soispha"; +AUTHORS="Soispha" # shellcheck disable=2034 -YEARS="2023"; +YEARS="2023" # shellcheck disable=2034 -VERSION="1.0.0"; +VERSION="1.0.0" +# NAME is from the wrapper +# shellcheck disable=SC2269 +NAME="$NAME" help() { -cat << EOF + cat <<EOF Scan images and turn them into a pdf. Usage: @@ -60,98 +62,97 @@ EOF } scan_adf() { - device="$1"; - sides_per_page="$2"; - method="ADF"; - for i in $(seq "$sides_per_page");do + device="$1" + sides_per_page="$2" + method="ADF" + for i in $(seq "$sides_per_page"); do do_until_success \ "scanimage --format=tiff --progress --source='$method' --device='$device' --batch=%d.tif --batch-increment='$sides_per_page' --batch-start='$i'" \ "warn 'Retrying scan, as we assume a network error!'" - - if [ "$sides_per_page" -ne 1 ];then - msg "Finished turn, please change side!"; + if [ "$sides_per_page" -ne 1 ]; then + msg "Finished turn, please change side!" readp "Press enter to continue" noop fi done } process_images_adf() { - tiff_temp_path="$1"; - output_directory="$2"; - name="$3"; + tiff_temp_path="$1" + output_directory="$2" + name="$3" - counter=0; - pdf_counter=0; + counter=0 + pdf_counter=0 image_cache="$(mktmp)" while read -r scanned_image; do - dbg "$scanned_image (scanned_image) at $counter (counter)"; - echo "$scanned_image" >> "$image_cache" + dbg "$scanned_image (scanned_image) at $counter (counter)" + echo "$scanned_image" >>"$image_cache" : $((counter += 1)) if [ "$counter" = "$number_of_pages" ]; then dbg "$counter == $number_of_pages" - counter=0; + counter=0 convert_images "$image_cache" "${name}_$pdf_counter" "$output_directory" : $((pdf_counter += 1)) - printf "" > "$image_cache" + printf "" >"$image_cache" fi - done < "$(tmp_pipe fd . "$tiff_temp_path" "|" sort -V)" + done <"$(tmp_pipe fd . "$tiff_temp_path" "|" sort -V)" } scan_flatbed() { - device="$1"; - number_of_pages"$2"; - method="Flatbed"; + device="$1" + number_of_pages"$2" + method="Flatbed" for i in $(seq "$number_of_pages"); do do_until_success \ "scanimage --format=tiff --progress --source='$method' --device='$device' --output-file=$i.tiff" \ "warn 'Retrying scan, as we assume a network error!'" - if [ "$number_of_pages" -ne 1 ];then - msg "Finished turn, please change side!"; + if [ "$number_of_pages" -ne 1 ]; then + msg "Finished turn, please change side!" readp "Press enter to continue" noop fi done } process_images_flatbed() { - tiff_temp_path="$1"; - output_directory="$2"; - name="$3"; + tiff_temp_path="$1" + output_directory="$2" + name="$3" - counter=0; + counter=0 image_cache="$(mktmp)" while read -r scanned_image; do - echo "$scanned_image" >> "$image_cache" + echo "$scanned_image" >>"$image_cache" : $((counter += 1)) if [ "$counter" = "$number_of_pages" ]; then - counter=0; + counter=0 convert_images "$image_cache" "$name" "$output_directory" - printf "" > "$image_cache" + printf "" >"$image_cache" fi - done < "$(tmp_pipe fd . "$tiff_temp_path" "|" sort -V)" + done <"$(tmp_pipe fd . "$tiff_temp_path" "|" sort -V)" } convert_images() { - image_cache="$1"; - pdf_name="$2"; - output_dir="$3"; + image_cache="$1" + pdf_name="$2" + output_dir="$3" set -- while read -r image; do - dbg "setting image: $image"; + dbg "setting image: $image" set -- "$@" "$image" - done < "$image_cache" + done <"$image_cache" while [ -e "$output_dir/${pdf_name}.pdf" ]; do pdf_name="${pdf_name}_$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 25)" done - dbg "using pdf_name: $pdf_name"; + dbg "using pdf_name: $pdf_name" convert "$@" -compress jpeg -quality 100 "$output_dir/${pdf_name}.pdf" } scan() { - number_of_pages="$1"; - device="$2"; - output_directory="$(readlink -f "$3")"; - name="$4"; - method="$5"; + number_of_pages="$1" + device="$2" + output_directory="$(readlink -f "$3")" + name="$4" + method="$5" [ -z "$number_of_pages" ] && die "Parameter 'number_of_pages' is not set!" [ -z "$device" ] && die "Parameter 'device' is not set!" @@ -159,21 +160,21 @@ scan() { [ -z "$name" ] && die "Parameter 'name' is not set!" [ -z "$method" ] && die "Parameter 'method' is not set!" - tiff_temp_path="$(mktmp -d)"; + tiff_temp_path="$(mktmp -d)" cd "$tiff_temp_path" || die "Bug" - msg "Started scanning..."; + msg "Started scanning..." if [ "$method" = "Flatbed" ]; then scan_flatbed "$device" "$number_of_pages" else scan_adf "$device" "$number_of_pages" fi - msg "Creating output directory..."; - mkdir "$output_directory"; + msg "Creating output directory..." + mkdir "$output_directory" cd "$output_directory" || die "Bug" - msg "Converting images to pdfs..."; + msg "Converting images to pdfs..." if [ "$method" = "Flatbed" ]; then process_images_flatbed "$tiff_temp_path" "$output_directory" "$name" else @@ -181,57 +182,53 @@ scan() { fi } - for input in "$@"; do case "$input" in - "--help" | "-h") - help; - exit 0; - ;; - "--version" | "-v") - version; - exit 0; - ;; + "--help" | "-h") + help + exit 0 + ;; + "--version" | "-v") + version + exit 0 + ;; esac done -number_of_pages="1"; -unset device; -output_directory="$(pwd)/pdf"; -unset name; -method="ADF"; +number_of_pages="1" +unset device +output_directory="$(pwd)/pdf" +unset name +method="ADF" while [ "$#" -ne 0 ]; do case "$1" in - "--help" | "-h") - ;; - "--version" | "-v") - ;; - "--out-dir" | "-o") - shift 1; - output_directory="$1"; - ;; - "--name" | "-n") - shift 1; - name="$1"; - ;; - "--num-pages" | "-p") - shift 1; - number_of_pages="$1"; - ;; - "--device" | "-d") - shift 1; - device="$1"; - ;; - "--method" | "-m") - shift 1; - method="$1"; - ;; - *) - die "Command line arg $1 does not exist. See --help for a list."; - ;; + "--help" | "-h") ;; + "--version" | "-v") ;; + "--out-dir" | "-o") + shift 1 + output_directory="$1" + ;; + "--name" | "-n") + shift 1 + name="$1" + ;; + "--num-pages" | "-p") + shift 1 + number_of_pages="$1" + ;; + "--device" | "-d") + shift 1 + device="$1" + ;; + "--method" | "-m") + shift 1 + method="$1" + ;; + *) + die "Command line arg $1 does not exist. See --help for a list." + ;; esac - shift 1; + shift 1 done -scan "$number_of_pages" "$device" "$output_directory" "$name" "$method"; - +scan "$number_of_pages" "$device" "$output_directory" "$name" "$method" diff --git a/hm/soispha/pkgs/scripts/apps/fupdate.1.md b/hm/soispha/pkgs/scripts/apps/fupdate.1.md index b2b7bf4f..710e8fb7 100644 --- a/hm/soispha/pkgs/scripts/apps/fupdate.1.md +++ b/hm/soispha/pkgs/scripts/apps/fupdate.1.md @@ -3,29 +3,34 @@ % May 2023 # NAME + fupdate - updates your flake, while checking for common mistakes # SYNOPSIS -**fupdate** list of [*flake*|*<some word>*|*--help*|*-h*] + +**fupdate** list of \[*flake*|*\<some word>*|*--help*|*-h*\] # DESCRIPTION + Argument can be stacked, this makes it possible to specify multiple targets to be updated in succession. See the Examples section for further details. No argument or *flake* : **fupdate**, when executed without arguments or with *flake*, will update your *flake.lock*, check for duplicate flake inputs, i.e., an input has an input declared, which you have also declared as input, and will run a script called *update.sh*, if you allow it. The allowance for the script is asked, when you run **fupdate** and the found script is not yet allowed. Furthermore, the allowance is based on the concrete sha256 hash of the script, so any changes will require another allowance. -**<some word>** as argument -: If the executable **update-<some word>** is reachable thought the PATH variable, than this is run. Otherwise, the program will exit. +**\<some word>** as argument +: If the executable **update-\<some word>** is reachable thought the PATH variable, than this is run. Otherwise, the program will exit. # OPTIONS -**\-\-help**, **-h** + +**--help**, **-h** : Displays a help message and exit. -**\-\-version**, **-v** +**--version**, **-v** : Displays the software version and exit. # EXAMPLES + **fupdate** or **fupdate flake** : Updates your *flake.lock*. See the Description section for further details. @@ -36,6 +41,7 @@ The allowance for the script is asked, when you run **fupdate** and the found sc : First updates your flake, then, if the command succeeded, runs **update-sys**, afterweich **update-docs** is run. # FILES + *update.sh* : This is supposed to be a shell script located in your flake base directory, i.e., the directory which contains both a *flake.nix* and a *flake.lock* file. @@ -43,9 +49,11 @@ The allowance for the script is asked, when you run **fupdate** and the found sc : **fupdate** will store the hashes to the allowed *update.sh* files here. # BUGS + Report bugs to <https://codeberg.org/soispha/flake_update/issues>. # COPYRIGHT + Copyright (C) 2023 Soispha This program is free software: you can redistribute it and/or modify diff --git a/hm/soispha/pkgs/scripts/apps/fupdate.sh b/hm/soispha/pkgs/scripts/apps/fupdate.sh index 7722c070..c038fa69 100755 --- a/hm/soispha/pkgs/scripts/apps/fupdate.sh +++ b/hm/soispha/pkgs/scripts/apps/fupdate.sh @@ -3,11 +3,13 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH +UPDATE_SCRIPT_NAME="update.sh" +CONFIG_DIRECTORY_PATH="$HOME/.local/share/flake-update" -UPDATE_SCRIPT_NAME="update.sh"; -CONFIG_DIRECTORY_PATH="$HOME/.local/share/flake-update"; - +# Both are used in version() +# shellcheck disable=SC2034 AUTHORS="Soispha" +# shellcheck disable=SC2034 YEARS="2023" # Searches upward for a `UPDATE_SCRIPT_NAME` script @@ -22,68 +24,68 @@ check_for_update_script() { # Checks if a given path to the update script is allowed. # Takes the path as input # Return 0, if allowed, 1 if not. -check_for_allowed_update_script(){ - update_script="$1"; - config_path="${CONFIG_DIRECTORY_PATH}${update_script}"; - update_script_hash="$(sha256sum "$update_script")"; +check_for_allowed_update_script() { + update_script="$1" + config_path="${CONFIG_DIRECTORY_PATH}${update_script}" + update_script_hash="$(sha256sum "$update_script")" if [ -f "$config_path" ]; then - if [ "$(cat "$config_path")" = "$update_script_hash" ];then - dbg "Recorded hash matches"; - return 0; + if [ "$(cat "$config_path")" = "$update_script_hash" ]; then + dbg "Recorded hash matches" + return 0 else - dbg "Recorded hash \'$(cat "$config_path")\' does not match real hash \'$update_script_hash\', assuming not allowed"; - return 1; + dbg "Recorded hash \'$(cat "$config_path")\' does not match real hash \'$update_script_hash\', assuming not allowed" + return 1 fi else - dbg "Path \'$config_path\' does not exist, assuming not allowed"; - return 1; + dbg "Path \'$config_path\' does not exist, assuming not allowed" + return 1 fi } - # Asks the user if they want to allow a given script. # Takes the path as input -ask_to_allow_update_script(){ - update_script="$1"; - config_path="${CONFIG_DIRECTORY_PATH}${update_script}"; - update_script_hash="$(sha256sum "$update_script")"; - println "\033[2J"; # clear the screen - cat "$update_script"; - readp "Do you want to allow this script?[N/y]: " allow; - dbg "allow is: $allow"; +ask_to_allow_update_script() { + update_script="$1" + config_path="${CONFIG_DIRECTORY_PATH}${update_script}" + update_script_hash="$(sha256sum "$update_script")" + println "\033[2J" # clear the screen + cat "$update_script" + readp "Do you want to allow this script?[N/y]: " allow + # shellcheck disable=SC2154 + dbg "allow is: $allow" case "$allow" in - [yY]) - dbg "allowed script"; - dbg "storing contents in: $config_path"; - mkdir --parents "$(dirname "$config_path")"; - print "$update_script_hash" > "$config_path"; - ;; - *) - UPDATE_SCRIPT_NOT_ALLOWED=true; - ;; + [yY]) + dbg "allowed script" + dbg "storing contents in: $config_path" + mkdir --parents "$(dirname "$config_path")" + print "$update_script_hash" >"$config_path" + ;; + *) + UPDATE_SCRIPT_NOT_ALLOWED=true + ;; esac } # Runs the provided script and continues to update the nix flake # Takes the path to the script and the directory to the flake as arguments # If the path to the update script is empty, it will be ignored -update(){ - update_script="$1"; - flake_base_dir="$2"; +update() { + update_script="$1" + flake_base_dir="$2" - [ "$update_script" = "" ] || "$update_script"; - dbg "changed directory to: $flake_base_dir"; - cd "$flake_base_dir" || die "Provided dir \'$flake_base_dir\' can not be accessed"; + [ "$update_script" = "" ] || "$update_script" + dbg "changed directory to: $flake_base_dir" + cd "$flake_base_dir" || die "Provided dir \'$flake_base_dir\' can not be accessed" nix flake update - if grep '[^0-9]_[0-9]' flake.lock > /dev/null; then - batgrep '[^0-9]_[0-9]' flake.lock; - die "Your flake.nix contains duplicate inputs!"; + if grep '[^0-9]_[0-9]' flake.lock >/dev/null; then + batgrep '[^0-9]_[0-9]' flake.lock + die "Your flake.nix contains duplicate inputs!" fi } help() { -cat << EOF + cat <<EOF This is a Nix flake update manager. Usage: @@ -105,63 +107,63 @@ EOF main() { if ! [ "$UPDATE_SCRIPT_NOT_ALLOWED" = true ]; then - update_script="$(check_for_update_script)"; - flake_base_dir="$(search_flake_base_dir)"; # Assume, that the update script is in the base dir - dbg "update_script is: $update_script"; - dbg "flake_base_dir is: $flake_base_dir"; + update_script="$(check_for_update_script)" + flake_base_dir="$(search_flake_base_dir)" # Assume, that the update script is in the base dir + dbg "update_script is: $update_script" + dbg "flake_base_dir is: $flake_base_dir" if [ "$update_script" = "" ]; then - update "" "$flake_base_dir"; + update "" "$flake_base_dir" elif check_for_allowed_update_script "$update_script" && ! [ "$update_script" = "" ]; then - update "$update_script" "$flake_base_dir"; + update "$update_script" "$flake_base_dir" else - ask_to_allow_update_script "$update_script"; - main; + ask_to_allow_update_script "$update_script" + main fi fi } if [ "$#" -eq 0 ]; then - main; + main fi for input in "$@"; do case "$input" in - "--help" | "-h") - help; - exit 0; - ;; - "--version" | "-v") - version; - exit 0; - ;; - "--") - end_of_cli_options=true; - ;; + "--help" | "-h") + help + exit 0 + ;; + "--version" | "-v") + version + exit 0 + ;; + "--") + end_of_cli_options=true + ;; esac [ "$end_of_cli_options" = "true" ] && break done while [ "$#" -ne 0 ]; do case "$1" in - "flake") - main; - shift 1; - ;; - *) - command="$1"; - shift 1; - [ "$1" = "--" ] && shift 1 - if which update-"$command" > /dev/null 2>&1;then - if [ "$end_of_cli_options" = "true" ]; then - update-"$command" "$@"; - else - update-"$command"; - fi + "flake") + main + shift 1 + ;; + *) + command="$1" + shift 1 + [ "$1" = "--" ] && shift 1 + if which update-"$command" >/dev/null 2>&1; then + if [ "$end_of_cli_options" = "true" ]; then + update-"$command" "$@" else - die "command \"update-$command\" is not executable, or does not exist"; + update-"$command" fi - ;; + else + die "command \"update-$command\" is not executable, or does not exist" + fi + ;; esac [ "$end_of_cli_options" = "true" ] && break done diff --git a/hm/soispha/pkgs/scripts/small_functions/screenshot_persistent.sh b/hm/soispha/pkgs/scripts/small_functions/screenshot_persistent.sh index 9e73bed3..5992e02f 100755 --- a/hm/soispha/pkgs/scripts/small_functions/screenshot_persistent.sh +++ b/hm/soispha/pkgs/scripts/small_functions/screenshot_persistent.sh @@ -6,20 +6,17 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH # only generate a path (this could lead to a time-of-check/time-of-use bug) tmp="$(mktmp --dry-run)" -if grim -g "$(slurp)" "$tmp" -then - name="$(rofi -dmenu -p "Name of screenshot: " -l 0)"; - screen_shot_path="$HOME/media/pictures/screenshots/$name.png"; - while [ -f "$screen_shot_path" ] - do +if grim -g "$(slurp)" "$tmp"; then + name="$(rofi -dmenu -p "Name of screenshot: " -l 0)" + screen_shot_path="$HOME/media/pictures/screenshots/$name.png" + while [ -f "$screen_shot_path" ]; do notify-send "Warning" 'Screenshot name already in use!' - name="$(rofi -dmenu -p "New name of screenshot: " -l 0)"; - screen_shot_path="$HOME/media/pictures/screenshots/$name.png"; + name="$(rofi -dmenu -p "New name of screenshot: " -l 0)" + screen_shot_path="$HOME/media/pictures/screenshots/$name.png" done - mv "$tmp" "$screen_shot_path"; - alacritty -e lf -command ":{{ set sortby atime; set reverse!; }}"; + mv "$tmp" "$screen_shot_path" + alacritty -e lf -command ":{{ set sortby atime; set reverse!; }}" fi - # vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/small_functions/update-sys.sh b/hm/soispha/pkgs/scripts/small_functions/update-sys.sh index 20e38841..68fb342d 100755 --- a/hm/soispha/pkgs/scripts/small_functions/update-sys.sh +++ b/hm/soispha/pkgs/scripts/small_functions/update-sys.sh @@ -4,7 +4,7 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH help() { - cat << EOF + cat <<EOF This is a NixOS System flake update manager. Usage: @@ -18,61 +18,60 @@ Options: --help | -h output this help. EOF - exit "$1"; + exit "$1" } -default_branch=$(mktmp); -BRANCH=""; +default_branch=$(mktmp) +BRANCH="" -while [ "$#" -gt 0 ];do +while [ "$#" -gt 0 ]; do case "$1" in - "--help" | "-h") - help 0; - ;; - "--branch" | "-b") - if [ -n "$2" ];then - BRANCH="$2"; - else - error "$1 requires an argument"; - help 1; - fi - shift 2; - ;; - "--mode" | "-m") - if [ -n "$2" ];then - MODE="$2"; - else - error "$1 requires an argument"; - help 1; - fi - shift 2; - ;; - *) - error "the option $1 does not exist!"; - help 1; - ;; + "--help" | "-h") + help 0 + ;; + "--branch" | "-b") + if [ -n "$2" ]; then + BRANCH="$2" + else + error "$1 requires an argument" + help 1 + fi + shift 2 + ;; + "--mode" | "-m") + if [ -n "$2" ]; then + MODE="$2" + else + error "$1 requires an argument" + help 1 + fi + shift 2 + ;; + *) + error "the option $1 does not exist!" + help 1 + ;; esac done - -cd /etc/nixos || die "No /etc/nixos"; -msg "Starting system update..."; -git remote update origin --prune > /dev/null 2>&1; -if ! [ "$BRANCH" = "" ];then - git switch "$BRANCH" > /dev/null 2>&1 && msg2 "Switched to branch '$BRANCH'"; +cd /etc/nixos || die "No /etc/nixos" +msg "Starting system update..." +git remote update origin --prune >/dev/null 2>&1 +if ! [ "$BRANCH" = "" ]; then + git switch "$BRANCH" >/dev/null 2>&1 && msg2 "Switched to branch '$BRANCH'" fi -msg2 "Updating git repository..."; -git pull --rebase; +msg2 "Updating git repository..." +git pull --rebase -git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' > "$default_branch" & +git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' >"$default_branch" & -msg2 "Updating system..."; +msg2 "Updating system..." if [ -n "$MODE" ]; then - nixos-rebuild "$MODE"; + nixos-rebuild "$MODE" else - nixos-rebuild switch; + nixos-rebuild switch fi -git switch "$(cat "$default_branch")" > /dev/null 2>&1 && msg2 "Switched to branch '$(cat "$default_branch")'"; -msg "Finished Update!"; +git switch "$(cat "$default_branch")" >/dev/null 2>&1 && msg2 "Switched to branch '$(cat "$default_branch")'" +msg "Finished Update!" # vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/specific/neorg/neorg_id_function.sh b/hm/soispha/pkgs/scripts/specific/neorg/neorg_id_function.sh index 413a18de..7c3fb2a3 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/neorg_id_function.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/neorg_id_function.sh @@ -1,12 +1,12 @@ #! /bin/sh -context="$(task _get rc.context)"; +context="$(task _get rc.context)" if [ "$context" ]; then - filter="project:$context"; + filter="project:$context" else - filter="0-10000"; + filter="0-10000" fi -tasks="$(task "$filter" _ids)"; +tasks="$(task "$filter" _ids)" if [ "$tasks" ]; then - echo "$tasks" | xargs task _zshids | awk -F: -v q="'" '{gsub(/'\''/, q "\\" q q ); print $1 ":" q $2 q}'; + echo "$tasks" | xargs task _zshids | awk -F: -v q="'" '{gsub(/'\''/, q "\\" q q ); print $1 ":" q $2 q}' fi diff --git a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/add.sh b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/add.sh index bd700775..5a830a10 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/add.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/add.sh @@ -1,23 +1,23 @@ #!/usr/bin/env dash add0open_taskwarrior_project_file() { - task_project_file="%TASK_PROJECT_FILE"; + task_project_file="%TASK_PROJECT_FILE" cd "$(dirname $task_project_file)" || die "BUG: task_project_file ('$task_project_file') can't be accessed" - git_dir="$(search_flake_base_dir)"; + git_dir="$(search_flake_base_dir)" [ "$git_dir" ] || die "(BUG): No git directory?" cd "$git_dir" || die "Unreachable, this MUST exists" - nvim "$task_project_file"; - git add "$task_project_file"; + nvim "$task_project_file" + git add "$task_project_file" base_task_project_file_path="$(awk "{ gsub(\"$git_dir/\", \"\", \$0); print }" "$(ptmp "$task_project_file")")" - git add $task_project_file; + git add $task_project_file # Check that only the project file has been added (and that our file is actually # modified) if git status --porcelain=v2 | awk -v path="$base_task_project_file_path" 'BEGIN { hit = 0 } { if ($2 ~ /A./ || $2 ~ /M./) { if ($NF ~ path) { hit = 1 } else { hit = 0; exit 1 } } } END { if (hit == 1) { exit 0 } else { exit 1 } }'; then - git commit --verbose --message="chore($(dirname "$base_task_project_file_path")): Update" + git commit --verbose --message="chore($(dirname "$base_task_project_file_path")): Update" fi } diff --git a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/context.sh b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/context.sh index b9ae4463..7095847d 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/context.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/context.sh @@ -4,40 +4,40 @@ context0open_current_task_context() { current_context="$(utils0get_current_context)" if [ "$current_context" ]; then - context_path="$(utils0get_current_context_path "$current_context")"; + context_path="$(utils0get_current_context_path "$current_context")" - extended_neorg_project_dir="$(utils0get_neorg_project_dir)"; - cd "$extended_neorg_project_dir" || die "(BUG?): Can not access the project dir: $extended_neorg_project_dir"; + extended_neorg_project_dir="$(utils0get_neorg_project_dir)" + cd "$extended_neorg_project_dir" || die "(BUG?): Can not access the project dir: $extended_neorg_project_dir" - nvim "$extended_neorg_project_dir/$context_path"; + nvim "$extended_neorg_project_dir/$context_path" - git add .; + git add . git commit --message="chore($(dirname "$context_path")): Update" --no-gpg-sign else - warn "No context active"; + warn "No context active" fi } context0open_current_task_context_at_task_id() { - task_id="$1"; + task_id="$1" current_context="$(utils0get_current_context)" if [ "$current_context" ]; then - context_path="$(utils0get_current_context_path "$current_context")"; - extended_neorg_project_dir="$(utils0get_neorg_project_dir)"; + context_path="$(utils0get_current_context_path "$current_context")" + extended_neorg_project_dir="$(utils0get_neorg_project_dir)" task_uuid="$(task "$task_id" uuids)" - cd "$extended_neorg_project_dir" || die "(BUG?): Can not access the project dir: $extended_neorg_project_dir"; + cd "$extended_neorg_project_dir" || die "(BUG?): Can not access the project dir: $extended_neorg_project_dir" if ! grep -q "% $task_uuid" "$extended_neorg_project_dir/$context_path"; then - echo "* TITLE (% $task_uuid)" >> "$extended_neorg_project_dir/$context_path" + echo "* TITLE (% $task_uuid)" >>"$extended_neorg_project_dir/$context_path" fi - nvim "$extended_neorg_project_dir/$context_path" -c "/% $task_uuid"; + nvim "$extended_neorg_project_dir/$context_path" -c "/% $task_uuid" - git add .; + git add . git commit --message="chore($(dirname "$context_path")): Update" --no-gpg-sign else - warn "No context active"; + warn "No context active" fi } diff --git a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/dmenu.sh b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/dmenu.sh index 36133004..73e9460a 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/dmenu.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/dmenu.sh @@ -1,12 +1,12 @@ #!/usr/bin/env dash dmenu0open_context_in_browser() { - project="$(echo "%ALL_PROJECTS_PIPE" | rofi -sep "|" -dmenu)"; + project="$(echo "%ALL_PROJECTS_PIPE" | rofi -sep "|" -dmenu)" if [ "$project" ]; then - project0open_project_in_browser "$project"; + project0open_project_in_browser "$project" else - notify-send "(neorg/dmenu) No project selected"; + notify-send "(neorg/dmenu) No project selected" exit 1 fi } diff --git a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/f_start.sh b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/f_start.sh index c75986a7..2423dd44 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/f_start.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/f_start.sh @@ -1,7 +1,7 @@ #!/usr/bin/env dash fstart0start_new_task() { - task_id="$1"; - fstop0stop_current_task; + task_id="$1" + fstop0stop_current_task task start "$task_id" } diff --git a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/f_stop.sh b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/f_stop.sh index d60cb46f..e4ff0b94 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/f_stop.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/f_stop.sh @@ -2,6 +2,6 @@ fstop0stop_current_task() { # we ensured that only one task may be active - active="$(task +ACTIVE _ids)"; - [ "$active" ] && task stop "$active"; + active="$(task +ACTIVE _ids)" + [ "$active" ] && task stop "$active" } diff --git a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/project.sh b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/project.sh index 8def0930..64591850 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/project.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/project.sh @@ -1,33 +1,32 @@ #!/usr/bin/env dash project0open_current_context_in_browser() { - current_context="$(utils0get_current_context)"; - [ "$current_context" ] || die "No current context to use"; - project0open_context_in_browser "$(utils0context2project "$current_context")"; + current_context="$(utils0get_current_context)" + [ "$current_context" ] || die "No current context to use" + project0open_context_in_browser "$(utils0context2project "$current_context")" } project0open_project_in_browser() { - project="$1"; + project="$1" [ "$project" ] || die "BUG: No context supplied to project0open_context_in_browser" - old_context="$(utils0get_current_context)"; + old_context="$(utils0get_current_context)" # We have ensured that only one task may be active - old_started_task="$(task +ACTIVE _ids)"; + old_started_task="$(task +ACTIVE _ids)" - tracking="$(mktmp)"; - task "project:$project" _ids | xargs --no-run-if-empty task _zshids > "$tracking"; + tracking="$(mktmp)" + task "project:$project" _ids | xargs --no-run-if-empty task _zshids >"$tracking" task context "$(utils0project2context "$project")" while read -r description; do - desc="$(echo "$description" | awk -F: '{print $2}' )"; + desc="$(echo "$description" | awk -F: '{print $2}')" if [ "$desc" = "tracking" ]; then - task_id="$(echo "$description" | awk -F: '{print $1}' )"; - notify-send "(Neorg)" "Starting task $project -> $desc"; + task_id="$(echo "$description" | awk -F: '{print $1}')" + notify-send "(Neorg)" "Starting task $project -> $desc" task start "$task_id" break fi - done < "$tracking" - + done <"$tracking" firefox -P "$project" diff --git a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/utils.sh b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/utils.sh index 91da811a..c3843e8e 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/utils.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/sh/functions/utils.sh @@ -3,19 +3,20 @@ # Runs it's first argument and then the second, regardless if the first failed or # succeeded utils0chain() { - eval "$1"; eval "$2" + eval "$1" + eval "$2" } utils0get_current_context() { - current_context="$(task _get rc.context)"; - printf "%s\n" "$current_context"; + current_context="$(task _get rc.context)" + printf "%s\n" "$current_context" } utils0get_current_context_path() { - current_context="$1"; - context_path="$(task _get rc.context."$current_context".rc.neorg_path 2>/dev/null)"; + current_context="$1" + context_path="$(task _get rc.context."$current_context".rc.neorg_path 2>/dev/null)" if ! [ "$context_path" ]; then - context_path="$(grep "context.$current_context.rc.neorg_path" "%HOME_TASKRC" | awk 'BEGIN {FS="="} {print $2}')"; + context_path="$(grep "context.$current_context.rc.neorg_path" "%HOME_TASKRC" | awk 'BEGIN {FS="="} {print $2}')" [ "$context_path" ] || die "All contexts should have a 'neorg_path' set!" fi printf "%s\n" "$context_path" @@ -23,18 +24,17 @@ utils0get_current_context_path() { utils0get_neorg_project_dir() { # Perform shell expansion of Tilde - neorg_project_dir="$(sed "s|^~|$HOME|" "$(ptmp "%DEFAULT_NEORG_PROJECT_DIR")")"; + neorg_project_dir="$(sed "s|^~|$HOME|" "$(ptmp "%DEFAULT_NEORG_PROJECT_DIR")")" printf "%s\n" "$neorg_project_dir" } - utils0project2context() { - project="$1"; - context="$(sed 's|\.|_|g' "$(ptmp "$project")")"; - printf "%s\n" "$context"; + project="$1" + context="$(sed 's|\.|_|g' "$(ptmp "$project")")" + printf "%s\n" "$context" } utils0context2project() { - context="$1"; - project="$(sed 's|_|\.|g' "$(ptmp "$context")")"; - printf "%s\n" "$project"; + context="$1" + project="$(sed 's|_|\.|g' "$(ptmp "$context")")" + printf "%s\n" "$project" } diff --git a/hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh b/hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh index 25b434fc..dc746ef8 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh @@ -14,7 +14,6 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH . ./functions/utils . ./functions/workspace - # these are used in version() # shellcheck disable=2034 AUTHORS="Soispha" @@ -24,7 +23,7 @@ YEARS="2023" NAME="neorg" help() { -cat << EOF + cat <<EOF This is the core interface to the system-integrated task management USAGE: @@ -82,75 +81,75 @@ EOF for arg in "$@"; do case "$arg" in - "--help" | "-h") - help; - exit 0; - ;; - "--version" | "-v") - version; - exit 0; - ;; + "--help" | "-h") + help + exit 0 + ;; + "--version" | "-v") + version + exit 0 + ;; esac done while [ "$#" -ne 0 ]; do case "$1" in - "t"*) # task - shift 1; - task_id="$1"; - [ "$task_id" ] || utils0chain context0open_current_task_context "exit 0" - context0open_current_task_context_at_task_id "$task_id"; - exit 0; - ;; - "w"*) # workspace - shift 1; - workspace_to_open="$1"; - # TODO: Exit with 1 on error, instead of the 0 <2023-10-20> - [ "$workspace_to_open" ] || utils0chain workspace0open_neorg_workspace_prompt "exit 0"; - workspace0open_neorg_workspace "$workspace_to_open"; - exit 0; - ;; - "p"*) # project - shift 1; - project_to_open="$1"; - # TODO: Exit with 1 on error, instead of the 0 <2023-10-20> - [ "$project_to_open" ] || utils0chain project0open_current_context_in_browser "exit 0"; - if ! grep -q "$project_to_open" "$(ptmp "%ALL_PROJECTS_NEWLINE")"; then - die "Your project ('$project_to_open') is not in the list of available projects: -%ALL_PROJECTS_COMMA"; - fi - project0open_project_in_browser "$project_to_open"; - exit 0; - ;; - "l"*) # list - list0list_all_contexts_newline; - exit 0 - ;; - "a"*) # add-project - add0open_taskwarrior_project_file; - exit 0 - ;; - "d"*) # dmenu - dmenu0open_context_in_browser; - exit 0 - ;; - "fsta"*) # fstart - shift 1; - task_id="$1"; - [ "$task_id" ] || die "No task id provided to fstart"; - fstart0start_new_task "$task_id"; - exit 0 - ;; - "fsto"*) # fstop - fstop0stop_current_task; - exit 0 - ;; - *) - die "Command '$1' does not exist! Please look at:\n $NAME --help"; - exit 0; - ;; + "t"*) # task + shift 1 + task_id="$1" + [ "$task_id" ] || utils0chain context0open_current_task_context "exit 0" + context0open_current_task_context_at_task_id "$task_id" + exit 0 + ;; + "w"*) # workspace + shift 1 + workspace_to_open="$1" + # TODO: Exit with 1 on error, instead of the 0 <2023-10-20> + [ "$workspace_to_open" ] || utils0chain workspace0open_neorg_workspace_prompt "exit 0" + workspace0open_neorg_workspace "$workspace_to_open" + exit 0 + ;; + "p"*) # project + shift 1 + project_to_open="$1" + # TODO: Exit with 1 on error, instead of the 0 <2023-10-20> + [ "$project_to_open" ] || utils0chain project0open_current_context_in_browser "exit 0" + if ! grep -q "$project_to_open" "$(ptmp "%ALL_PROJECTS_NEWLINE")"; then + die "Your project ('$project_to_open') is not in the list of available projects: +%ALL_PROJECTS_COMMA" + fi + project0open_project_in_browser "$project_to_open" + exit 0 + ;; + "l"*) # list + list0list_all_contexts_newline + exit 0 + ;; + "a"*) # add-project + add0open_taskwarrior_project_file + exit 0 + ;; + "d"*) # dmenu + dmenu0open_context_in_browser + exit 0 + ;; + "fsta"*) # fstart + shift 1 + task_id="$1" + [ "$task_id" ] || die "No task id provided to fstart" + fstart0start_new_task "$task_id" + exit 0 + ;; + "fsto"*) # fstop + fstop0stop_current_task + exit 0 + ;; + *) + die "Command '$1' does not exist! Please look at:\n $NAME --help" + exit 0 + ;; esac done -context0open_current_task_context; +context0open_current_task_context # vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/hibernate.sh b/hm/soispha/pkgs/scripts/wrappers/hibernate.sh index 96170bcb..f3e74732 100755 --- a/hm/soispha/pkgs/scripts/wrappers/hibernate.sh +++ b/hm/soispha/pkgs/scripts/wrappers/hibernate.sh @@ -3,14 +3,13 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH -context="$(task _get rc.context)"; +context="$(task _get rc.context)" [ "$context" ] && task context none # We have ensured that only one task is active -active="$(task +ACTIVE _ids)"; +active="$(task +ACTIVE _ids)" [ "$active" ] && task stop "$active" systemctl hibernate "$@" - # vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/lock.sh b/hm/soispha/pkgs/scripts/wrappers/lock.sh index 376773c6..f1c5c711 100755 --- a/hm/soispha/pkgs/scripts/wrappers/lock.sh +++ b/hm/soispha/pkgs/scripts/wrappers/lock.sh @@ -3,12 +3,11 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -context="$(task _get rc.context)"; +context="$(task _get rc.context)" [ "$context" ] && task context none # We have ensured that only one task is active -active="$(task +ACTIVE _ids)"; +active="$(task +ACTIVE _ids)" [ "$active" ] && task stop "$active" swaylock diff --git a/hm/soispha/pkgs/scripts/wrappers/mpc-fav.sh b/hm/soispha/pkgs/scripts/wrappers/mpc-fav.sh index f9107ff6..7385ce43 100755 --- a/hm/soispha/pkgs/scripts/wrappers/mpc-fav.sh +++ b/hm/soispha/pkgs/scripts/wrappers/mpc-fav.sh @@ -3,13 +3,12 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH -FAV_DIR="$XDG_MUSIC_DIR/playlists/favourites"; +FAV_DIR="$XDG_MUSIC_DIR/playlists/favourites" -cd "$XDG_MUSIC_DIR" || die "No music dir!"; +cd "$XDG_MUSIC_DIR" || die "No music dir!" -[ -d "$FAV_DIR" ] || mkdir --parents "$FAV_DIR"; - -ln -sr "$(mpc --format '%file%' current)" "$FAV_DIR/" || die "Link failed!"; +[ -d "$FAV_DIR" ] || mkdir --parents "$FAV_DIR" +ln -sr "$(mpc --format '%file%' current)" "$FAV_DIR/" || die "Link failed!" # vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/mpc-rm.sh b/hm/soispha/pkgs/scripts/wrappers/mpc-rm.sh index cc01c322..03673dbe 100755 --- a/hm/soispha/pkgs/scripts/wrappers/mpc-rm.sh +++ b/hm/soispha/pkgs/scripts/wrappers/mpc-rm.sh @@ -3,12 +3,8 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - cd "$XDG_MUSIC_DIR" || die "No music dir!" -trash-put "$(mpc --format '%file%' current)"; -mpc del 0; - - - +trash-put "$(mpc --format '%file%' current)" +mpc del 0 # vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/sort_song.sh b/hm/soispha/pkgs/scripts/wrappers/sort_song.sh index f539cf15..8195cfcf 100755 --- a/hm/soispha/pkgs/scripts/wrappers/sort_song.sh +++ b/hm/soispha/pkgs/scripts/wrappers/sort_song.sh @@ -3,31 +3,32 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH -case "$("$1" | tr '[:upper:]' '[:lower:]')" in - "lyrics") - filter="LYRICS"; - directory="lyrics"; - ;; - "instrumental") - filter="INSTRUMENTAL"; - directory="instrumental"; - ;; - *) - die "Expected 'instrumental|lyrics' but got '$1'"; +case "$("$1" | tr '[:upper:]' '[:lower:]')" in +"lyrics") + filter="LYRICS" + directory="lyrics" + ;; +"instrumental") + filter="INSTRUMENTAL" + directory="instrumental" + ;; +*) + die "Expected 'instrumental|lyrics' but got '$1'" + ;; esac process() { mediainfo --Output=JSON "$1" | jq '.media.track | map(.Lyrics) | join("")' -}; +} -mkdir "../$directory"; +mkdir "../$directory" fd . --extension=opus | while read -r file; do if [ "$(process "$file")" = '""' ] || [ "$(process "$file")" = '"Instrumental"' ] || [ "$(process "$file")" = '"instrumental"' ]; then - echo "INSTRUMENTAL::$file"; + echo "INSTRUMENTAL::$file" else - echo "LYRICS::$file"; - fi; - done | grep "$filter" | awk 'BEGIN {FS="::"}{print $2}' | while read -r file; do ln -s "../all/$file" "../$directory/$file"; done + echo "LYRICS::$file" + fi +done | grep "$filter" | awk 'BEGIN {FS="::"}{print $2}' | while read -r file; do ln -s "../all/$file" "../$directory/$file"; done # vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/spodi.sh b/hm/soispha/pkgs/scripts/wrappers/spodi.sh index f8bc5337..8b4188b0 100755 --- a/hm/soispha/pkgs/scripts/wrappers/spodi.sh +++ b/hm/soispha/pkgs/scripts/wrappers/spodi.sh @@ -4,17 +4,15 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH # This path must not contain spaces -DOWN_DIR="/home/soispha/media/music/down/spotify"; - -download_url="$1"; - +DOWN_DIR="/home/soispha/media/music/down/spotify" +download_url="$1" already_downloaded_files="$(mktmp)" -fd . "$DOWN_DIR" --exclude spotdl.log --exclude spotdl-errors.log > "$already_downloaded_files"; +fd . "$DOWN_DIR" --exclude spotdl.log --exclude spotdl-errors.log >"$already_downloaded_files" config="$(mktmp)" -cat << EOF | clean > "$config" +cat <<EOF | clean >"$config" # Main options --audio slider-kz bandcamp youtube-music piped youtube soundcloud --lyrics genius musixmatch azlyrics synced @@ -41,7 +39,7 @@ cat << EOF | clean > "$config" --log-level INFO EOF -if [ -z "$NO_CHECK" ] && [ "$(wc -l < "$already_downloaded_files" )" -ne 0 ];then +if [ -z "$NO_CHECK" ] && [ "$(wc -l <"$already_downloaded_files")" -ne 0 ]; then die "something is already downloaded" fi @@ -49,7 +47,6 @@ rm "$DOWN_DIR/spotdl.log" cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" touch "$DOWN_DIR/spotdl-errors.log" - # The sub shell needs to be unquoted, as the arguments may not be treated as one. # shellcheck disable=2046 unbuffer spotdl $(cat "$config") download "$download_url" | tee "$DOWN_DIR/spotdl.log" diff --git a/hm/soispha/pkgs/scripts/wrappers/yti.sh b/hm/soispha/pkgs/scripts/wrappers/yti.sh index c07f6665..caa5f443 100755 --- a/hm/soispha/pkgs/scripts/wrappers/yti.sh +++ b/hm/soispha/pkgs/scripts/wrappers/yti.sh @@ -8,10 +8,10 @@ DOWN_DIR=/home/soispha/media/music/down/youtube tmp=$(mktmp) config=$(mktmp) -for e in "$DOWN_DIR"/*.opus;do echo "$e" >> "$tmp";done +for e in "$DOWN_DIR"/*.opus; do echo "$e" >>"$tmp"; done [ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" -cat << EO > "$config" +cat <<EO >"$config" --paths home:"$DOWN_DIR" #--output %(fulltitle) --restrict-filenames @@ -25,7 +25,6 @@ cat << EO > "$config" --audio-format best EO - rm "$DOWN_DIR/yt-dlp.log" cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" diff --git a/hm/soispha/wms/river/init.sh b/hm/soispha/wms/river/init.sh index 07b30732..9ec48d41 100755 --- a/hm/soispha/wms/river/init.sh +++ b/hm/soispha/wms/river/init.sh @@ -4,15 +4,15 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH err_fail() { - if ! "$@";then - warning "\"$*\" failed!\n" >> ~/river_log + if ! "$@"; then + warning "\"$*\" failed!\n" >>~/river_log # msg "Executing the safe init!" # exec ~/.config/river/res/safe_init.sh fi } err_fail rm ~/river_log -exec 1>> "$HOME"/river_log -exec 2>> "$HOME"/river_log +exec 1>>"$HOME"/river_log +exec 2>>"$HOME"/river_log #trap err_fail ERR @@ -69,8 +69,6 @@ err_fail swayidle & err_fail alacritty & # }}} - - # Setup of layout [acts as exec!] {{{ err_fail riverctl default-layout rivertile @env_vars@ rivertile -main-ratio 0.5 -view-padding 1 -outer-padding 0 diff --git a/hm/soispha/wms/river/res/safe_init.sh b/hm/soispha/wms/river/res/safe_init.sh deleted file mode 100755 index 8e80026a..00000000 --- a/hm/soispha/wms/river/res/safe_init.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh - -# This is the example configuration file for river. -# -# If you wish to edit this, you will probably want to copy it to -# $XDG_CONFIG_HOME/river/init or $HOME/.config/river/init first. -# -# See the river(1), riverctl(1), and rivertile(1) man pages for complete -# documentation. - -# Note: the "Super" modifier is also known as Logo, GUI, Windows, Mod4, etc. - -# Super+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot) -riverctl map normal Super Return spawn alacritty - -# Super+Q to close the focused view -riverctl map normal Super Q close - -# Super+Shift+E to exit river -riverctl map normal Super+Shift Q exit - -# Super+J and Super+K to focus the next/previous view in the layout stack -riverctl map normal Super J focus-view next -riverctl map normal Super K focus-view previous - -# Super+Shift+J and Super+Shift+K to swap the focused view with the next/previous -# view in the layout stack -riverctl map normal Super+Shift J swap next -riverctl map normal Super+Shift K swap previous - -# Super+Period and Super+Comma to focus the next/previous output -riverctl map normal Super Period focus-output next -riverctl map normal Super Comma focus-output previous - -# Super+Shift+{Period,Comma} to send the focused view to the next/previous output -riverctl map normal Super+Shift Period send-to-output next -riverctl map normal Super+Shift Comma send-to-output previous - -# Super+Return to bump the focused view to the top of the layout stack -riverctl map normal Super Return zoom - -# Super+H and Super+L to decrease/increase the main ratio of rivertile(1) -riverctl map normal Super H send-layout-cmd rivertile "main-ratio -0.05" -riverctl map normal Super L send-layout-cmd rivertile "main-ratio +0.05" - -# Super+Shift+H and Super+Shift+L to increment/decrement the main count of rivertile(1) -riverctl map normal Super+Shift H send-layout-cmd rivertile "main-count +1" -riverctl map normal Super+Shift L send-layout-cmd rivertile "main-count -1" - -# Super+Alt+{H,J,K,L} to move views -riverctl map normal Super+Alt H move left 100 -riverctl map normal Super+Alt J move down 100 -riverctl map normal Super+Alt K move up 100 -riverctl map normal Super+Alt L move right 100 - -# Super+Alt+Control+{H,J,K,L} to snap views to screen edges -riverctl map normal Super+Alt+Control H snap left -riverctl map normal Super+Alt+Control J snap down -riverctl map normal Super+Alt+Control K snap up -riverctl map normal Super+Alt+Control L snap right - -# Super+Alt+Shift+{H,J,K,L} to resize views -riverctl map normal Super+Alt+Shift H resize horizontal -100 -riverctl map normal Super+Alt+Shift J resize vertical 100 -riverctl map normal Super+Alt+Shift K resize vertical -100 -riverctl map normal Super+Alt+Shift L resize horizontal 100 - -# Super + Left Mouse Button to move views -riverctl map-pointer normal Super BTN_LEFT move-view - -# Super + Right Mouse Button to resize views -riverctl map-pointer normal Super BTN_RIGHT resize-view - -for i in $(seq 1 9) -do - tags=$((1 << ($i - 1))) - - # Super+[1-9] to focus tag [0-8] - riverctl map normal Super $i set-focused-tags $tags - - # Super+Shift+[1-9] to tag focused view with tag [0-8] - riverctl map normal Super+Shift $i set-view-tags $tags - - # Super+Ctrl+[1-9] to toggle focus of tag [0-8] - riverctl map normal Super+Control $i toggle-focused-tags $tags - - # Super+Shift+Ctrl+[1-9] to toggle tag [0-8] of focused view - riverctl map normal Super+Shift+Control $i toggle-view-tags $tags -done - -# Super+0 to focus all tags -# Super+Shift+0 to tag focused view with all tags -all_tags=$(((1 << 32) - 1)) -riverctl map normal Super 0 set-focused-tags $all_tags -riverctl map normal Super+Shift 0 set-view-tags $all_tags - -# Super+Space to toggle float -riverctl map normal Super Space toggle-float - -# Super+F to toggle fullscreen -riverctl map normal Super F toggle-fullscreen - -# Super+{Up,Right,Down,Left} to change layout orientation -riverctl map normal Super Up send-layout-cmd rivertile "main-location top" -riverctl map normal Super Right send-layout-cmd rivertile "main-location right" -riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom" -riverctl map normal Super Left send-layout-cmd rivertile "main-location left" - -# Declare a passthrough mode. This mode has only a single mapping to return to -# normal mode. This makes it useful for testing a nested wayland compositor -riverctl declare-mode passthrough - -# Super+F11 to enter passthrough mode -riverctl map normal Super F11 enter-mode passthrough - -# Super+F11 to return to normal mode -riverctl map passthrough Super F11 enter-mode normal - -# Various media key mapping examples for both normal and locked mode which do -# not have a modifier -for mode in normal locked -do - # Eject the optical drive (well if you still have one that is) - riverctl map $mode None XF86Eject spawn 'eject -T' - - # Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer) - riverctl map $mode None XF86AudioRaiseVolume spawn 'pamixer -i 5' - riverctl map $mode None XF86AudioLowerVolume spawn 'pamixer -d 5' - riverctl map $mode None XF86AudioMute spawn 'pamixer --toggle-mute' - - # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl) - riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause' - riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause' - riverctl map $mode None XF86AudioPrev spawn 'playerctl previous' - riverctl map $mode None XF86AudioNext spawn 'playerctl next' - - # Control screen backlight brightness with light (https://github.com/haikarainen/light) - riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 5' - riverctl map $mode None XF86MonBrightnessDown spawn 'light -U 5' -done - -# Set background and border color -riverctl background-color 0x002b36 -riverctl border-color-focused 0x93a1a1 -riverctl border-color-unfocused 0x586e75 - -# Set keyboard repeat rate -riverctl set-repeat 50 300 - -# Make certain views start floating -riverctl float-filter-add app-id float -riverctl float-filter-add title "popup title with spaces" - -# Set app-ids and titles of views which should use client side decorations -riverctl csd-filter-add app-id "gedit" - -# Set the default layout generator to be rivertile and start it. -# River will send the process group of the init executable SIGTERM on exit. -riverctl default-layout rivertile -rivertile -view-padding 6 -outer-padding 6 diff --git a/notes/git_crypt.md b/notes/git_crypt.md index 6b2cb765..4e192a89 100644 --- a/notes/git_crypt.md +++ b/notes/git_crypt.md @@ -1,6 +1,7 @@ # what to do, when nix wants to build the locked repository Simply delete the source path: + ``` sudo nix store delete --ignore-liveness <source_path> ``` diff --git a/notes/gpg_keys.md b/notes/gpg_keys.md index c77a6bde..39602e3b 100644 --- a/notes/gpg_keys.md +++ b/notes/gpg_keys.md @@ -1,45 +1,48 @@ # How to add a comment to gpg keys + Export it as follows: + ```bash gpg --export --armor --comment '<keyid>' <add comments for every line in ` gpg -k`> <key_name> > key_out.gpg ``` + or add it manually, the supported options include (RFC4880): - - "Version", which states the OpenPGP implementation and version - used to encode the message. - - - "Comment", a user-defined comment. OpenPGP defines all text to - be in UTF-8. A comment may be any UTF-8 string. However, the - whole point of armoring is to provide seven-bit-clean data. - Consequently, if a comment has characters that are outside the - US-ASCII range of UTF, they may very well not survive transport. - - - "MessageID", a 32-character string of printable characters. The - string must be the same for all parts of a multi-part message - that uses the "PART X" Armor Header. MessageID strings should be - unique enough that the recipient of the mail can associate all - the parts of a message with each other. A good checksum or - cryptographic hash function is sufficient. - - The MessageID SHOULD NOT appear unless it is in a multi-part - message. If it appears at all, it MUST be computed from the - finished (encrypted, signed, etc.) message in a deterministic - fashion, rather than contain a purely random value. This is to - allow the legitimate recipient to determine that the MessageID - cannot serve as a covert means of leaking cryptographic key - information. - - - "Hash", a comma-separated list of hash algorithms used in this - message. This is used only in cleartext signed messages. - - - "Charset", a description of the character set that the plaintext - is in. Please note that OpenPGP defines text to be in UTF-8. An - implementation will get best results by translating into and out - of UTF-8. However, there are many instances where this is easier - said than done. Also, there are communities of users who have no - need for UTF-8 because they are all happy with a character set - like ISO Latin-5 or a Japanese character set. In such instances, - an implementation MAY override the UTF-8 default by using this - header key. An implementation MAY implement this key and any - translations it cares to; an implementation MAY ignore it and - assume all text is UTF-8. +- "Version", which states the OpenPGP implementation and version + used to encode the message. + +- "Comment", a user-defined comment. OpenPGP defines all text to + be in UTF-8. A comment may be any UTF-8 string. However, the + whole point of armoring is to provide seven-bit-clean data. + Consequently, if a comment has characters that are outside the + US-ASCII range of UTF, they may very well not survive transport. + +- "MessageID", a 32-character string of printable characters. The + string must be the same for all parts of a multi-part message + that uses the "PART X" Armor Header. MessageID strings should be + unique enough that the recipient of the mail can associate all + the parts of a message with each other. A good checksum or + cryptographic hash function is sufficient. + + The MessageID SHOULD NOT appear unless it is in a multi-part + message. If it appears at all, it MUST be computed from the + finished (encrypted, signed, etc.) message in a deterministic + fashion, rather than contain a purely random value. This is to + allow the legitimate recipient to determine that the MessageID + cannot serve as a covert means of leaking cryptographic key + information. + +- "Hash", a comma-separated list of hash algorithms used in this + message. This is used only in cleartext signed messages. + +- "Charset", a description of the character set that the plaintext + is in. Please note that OpenPGP defines text to be in UTF-8. An + implementation will get best results by translating into and out + of UTF-8. However, there are many instances where this is easier + said than done. Also, there are communities of users who have no + need for UTF-8 because they are all happy with a character set + like ISO Latin-5 or a Japanese character set. In such instances, + an implementation MAY override the UTF-8 default by using this + header key. An implementation MAY implement this key and any + translations it cares to; an implementation MAY ignore it and + assume all text is UTF-8. diff --git a/notes/laptop.md b/notes/laptop.md index 9f809e30..38ae5a24 100644 --- a/notes/laptop.md +++ b/notes/laptop.md @@ -1,8 +1,12 @@ # backlight + Run `ls /sys/class/backlight` to see possible options. # brightness - #! / bin / bash - brightness = $ (cat / sys / class / backlight / intel_backlight / brightness) - brightness = $ (expr $ brightness - 300) - echo $ brightness> / sys / class / backlight / intel_backlight / brightness + +``` +#! / bin / bash +brightness = $ (cat / sys / class / backlight / intel_backlight / brightness) +brightness = $ (expr $ brightness - 300) +echo $ brightness> / sys / class / backlight / intel_backlight / brightness +``` diff --git a/notes/names.md b/notes/names.md index 53eefe1c..44339580 100644 --- a/notes/names.md +++ b/notes/names.md @@ -1,4 +1,6 @@ # Naming scheme + The hosts naming scheme follows two list of Mesopotamian (Babylonian) deities: + - https://en.wikipedia.org/wiki/List_of_Mesopotamian_deities - https://namingschemes.com/Babylonian_Gods diff --git a/notes/password.md b/notes/password.md index ff79aa38..96366bae 100644 --- a/notes/password.md +++ b/notes/password.md @@ -1,2 +1,3 @@ # Password + Run `nix run n#mkpasswd -- -m yescrypt -s -R 11` diff --git a/sys/nixpkgs/pkgs/plgs-pkgs/README.md b/sys/nixpkgs/pkgs/plgs-pkgs/README.md index ed05f4b2..e8169951 100644 --- a/sys/nixpkgs/pkgs/plgs-pkgs/README.md +++ b/sys/nixpkgs/pkgs/plgs-pkgs/README.md @@ -1,6 +1,8 @@ # Fork + All files in this repository where forked form [here](https://github.com/NixNeovim/NixNeovimPlugins) on commit `5010b91eb03696574c3c293f072a090618227e87`. Below the original README. They were licensed under the MIT license. + # All vim plugins, ready to go This repo auto generates nix packages for vim/neovim plugins. @@ -51,12 +53,6 @@ Finally, you can add the packages to your vim/neovim config. For example you can More info on using neovim with nix can be found here: [NixOS Neovim](https://nixos.wiki/wiki/Neovim) -[0]: https://github.com/rockerBOO/awesome-neovim -[1]: https://nixos.org/manual/nix/stable/release-notes/rl-2.4.html?highlight=builtins.getFlake#other-features -[2]: https://nur.nix-community.org/ -[3]: https://nur.nix-community.org/repos/m15a/ - - ## Contribution ### How to add a new plugin @@ -92,3 +88,5 @@ The GitHub Actions will do the rest, including removing the entry from manifest. ## Credits This is originally based on work by [m15a](https://github.com/m15a/nixpkgs-vim-extra-plugins) + +[0]: https://github.com/rockerBOO/awesome-neovim diff --git a/sys/nixpkgs/pkgs/plgs-pkgs/plugins/plugins.md b/sys/nixpkgs/pkgs/plgs-pkgs/plugins/plugins.md index bb4f6537..b990c877 100644 --- a/sys/nixpkgs/pkgs/plgs-pkgs/plugins/plugins.md +++ b/sys/nixpkgs/pkgs/plgs-pkgs/plugins/plugins.md @@ -1,4 +1,4 @@ - - Plugin count: 4 +- Plugin count: 4 | Repo | Last Update | Nix package name | Last checked | |:---|:---|:---|:---| diff --git a/sys/nixpkgs/pkgs/plgs-pkgs/update.sh b/sys/nixpkgs/pkgs/plgs-pkgs/update.sh index ea71c6fa..6a0d3452 100755 --- a/sys/nixpkgs/pkgs/plgs-pkgs/update.sh +++ b/sys/nixpkgs/pkgs/plgs-pkgs/update.sh @@ -9,11 +9,13 @@ cd "$BASE_DIR" || (echo "BUG: No '$BASE_DIR'" && exit 1) sort -o "$BASE_DIR/manifest.txt" "$BASE_DIR/manifest.txt" sort -o "$BASE_DIR/blacklist.txt" "$BASE_DIR/blacklist.txt" ## Remove all plugins, which are on the blacklist -echo "$(comm -23 "$BASE_DIR/manifest.txt" "$BASE_DIR/blacklist.txt")" > "$BASE_DIR/manifest.txt" +# The same file is read and written to +# shellcheck disable=SC2005 +echo "$(comm -23 "$BASE_DIR/manifest.txt" "$BASE_DIR/blacklist.txt")" >"$BASE_DIR/manifest.txt" # Backup vim-plugins.nix mv "$BASE_DIR/default.nix" "$BASE_DIR/default.nix.bak" -echo "{...} : {}" > "$BASE_DIR/default.nix" +echo "{...} : {}" >"$BASE_DIR/default.nix" # Generate derivations for new plugins (this binary is provided by the dev-environment) update-vim-plugins cleanup "$BASE_DIR" @@ -21,6 +23,5 @@ update-vim-plugins cleanup "$BASE_DIR" # Restore vim-plugins.nix mv "$BASE_DIR/default.nix.bak" "$BASE_DIR/default.nix" - # Update new plugins update-vim-plugins update "$BASE_DIR" --all diff --git a/sys/nixpkgs/pkgs/snap-sync-forked/snap-sync-forked.sh b/sys/nixpkgs/pkgs/snap-sync-forked/snap-sync-forked.sh index a66f31ae..47230667 100755 --- a/sys/nixpkgs/pkgs/snap-sync-forked/snap-sync-forked.sh +++ b/sys/nixpkgs/pkgs/snap-sync-forked/snap-sync-forked.sh @@ -37,12 +37,12 @@ printf "snap-sync comes with ABSOLUTELY NO WARRANTY. This is free software, and SNAPPER_CONFIG=/etc/sysconfig/snapper donotify=0 -if ! command -v notify-send &> /dev/null; then +if ! command -v notify-send &>/dev/null; then donotify=1 fi doprogress=0 -if ! command -v pv &> /dev/null; then +if ! command -v pv &>/dev/null; then doprogress=1 fi @@ -73,7 +73,7 @@ trap 'traperror ${LINENO} $? "$BASH_COMMAND" $BASH_LINENO "${FUNCNAME[@]}"' ERR trap trapkill SIGTERM SIGINT usage() { - cat <<EOF + cat <<EOF $name $version Usage: $name [options] @@ -100,52 +100,52 @@ sudo=0 while [[ $# -gt 0 ]]; do key="$1" case $key in - -d|--description) - description="$2" - shift 2 + -d | --description) + description="$2" + shift 2 ;; - -c|--config) - selected_configs="$2" - shift 2 + -c | --config) + selected_configs="$2" + shift 2 ;; - -u|--UUID) - uuid_cmdline="$2" - shift 2 + -u | --UUID) + uuid_cmdline="$2" + shift 2 ;; - -s|--subvolid) - subvolid_cmdline="$2" - shift 2 + -s | --subvolid) + subvolid_cmdline="$2" + shift 2 ;; - -k|--keepold) - keep="yes" - shift + -k | --keepold) + keep="yes" + shift ;; - -n|--noconfirm) - noconfirm="yes" - shift + -n | --noconfirm) + noconfirm="yes" + shift ;; - -h|--help) - usage - exit 1 + -h | --help) + usage + exit 1 ;; - -q|--quiet) - donotify=1 - shift + -q | --quiet) + donotify=1 + shift ;; - -r|--remote) - remote=$2 - shift 2 - ;; - -p|--port) - port=$2 - shift 2 - ;; - --sudo) - sudo=1 - shift + -r | --remote) + remote=$2 + shift 2 ;; - *) - die "Unknown option: '$key'. Run '$name -h' for valid options." + -p | --port) + port=$2 + shift 2 + ;; + --sudo) + sudo=1 + shift + ;; + *) + die "Unknown option: '$key'. Run '$name -h' for valid options." ;; esac done @@ -153,8 +153,8 @@ done notify() { for u in $(users | tr ' ' '\n' | sort -u); do sudo -u "$u" DISPLAY=:0 \ - DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(sudo -u "$u" id -u)/bus" \ - notify-send -a $name "$1" "$2" --icon="dialog-$3" + DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(sudo -u "$u" id -u)/bus" \ + notify-send -a $name "$1" "$2" --icon="dialog-$3" done } @@ -183,12 +183,12 @@ subvolid_cmdline=${subvolid_cmdline:-"5"} noconfirm=${noconfirm:-"no"} if [[ -z $remote ]]; then - if ! command -v rsync &> /dev/null; then + if ! command -v rsync &>/dev/null; then die "--remote specified but rsync command not found" fi fi -if [[ "$uuid_cmdline" != "none" ]]; then +if [[ $uuid_cmdline != "none" ]]; then if [[ -z $remote ]]; then notify_info "Backup started" "Starting backups to $uuid_cmdline subvolid=$subvolid_cmdline..." else @@ -227,34 +227,34 @@ declare -a SUBVOLIDS_ARRAY i=0 for x in $TARGETS; do - SUBVOLIDS_ARRAY[$i]=$($ssh btrfs subvolume show "$x" | awk '/Subvolume ID:/ { print $3 }') - TARGETS_ARRAY[$i]=$x - i=$((i+1)) + SUBVOLIDS_ARRAY[i]=$($ssh btrfs subvolume show "$x" | awk '/Subvolume ID:/ { print $3 }') + TARGETS_ARRAY[i]=$x + i=$((i + 1)) done i=0 disk=-1 disk_count=0 for x in $UUIDS; do - UUIDS_ARRAY[$i]=$x - if [[ "$x" == "$uuid_cmdline" && ${SUBVOLIDS_ARRAY[$((i))]} == "$subvolid_cmdline" ]]; then + UUIDS_ARRAY[i]=$x + if [[ $x == "$uuid_cmdline" && ${SUBVOLIDS_ARRAY[$((i))]} == "$subvolid_cmdline" ]]; then disk=$i - disk_count=$((disk_count+1)) + disk_count=$((disk_count + 1)) fi - i=$((i+1)) + i=$((i + 1)) done -if [[ "${#UUIDS_ARRAY[$@]}" -eq 0 ]]; then +if [[ ${#UUIDS_ARRAY[$@]} -eq 0 ]]; then die "No external btrfs subvolumes found to backup to. Run '$name -h' for more options." fi -if [[ "$disk_count" -gt 1 ]]; then +if [[ $disk_count -gt 1 ]]; then printf "Multiple mount points were found with UUID %s and subvolid %s.\n" "$uuid_cmdline" "$subvolid_cmdline" disk="-1" fi -if [[ "$disk" == -1 ]]; then - if [[ "$disk_count" == 0 && "$uuid_cmdline" != "none" ]]; then +if [[ $disk == -1 ]]; then + if [[ $disk_count == 0 && $uuid_cmdline != "none" ]]; then error "A device with UUID $uuid_cmdline and subvolid $subvolid_cmdline was not found to be mounted, or it is not a BTRFS device." fi if [[ -z $ssh ]]; then @@ -264,7 +264,7 @@ if [[ "$disk" == -1 ]]; then fi while [[ $disk -lt 0 || $disk -gt $i ]]; do for x in "${!TARGETS_ARRAY[@]}"; do - printf "%4s) %s (uuid=%s, subvolid=%s)\n" "$((x+1))" "${TARGETS_ARRAY[$x]}" "${UUIDS_ARRAY[$x]}" "${SUBVOLIDS_ARRAY[$x]}" + printf "%4s) %s (uuid=%s, subvolid=%s)\n" "$((x + 1))" "${TARGETS_ARRAY[$x]}" "${UUIDS_ARRAY[$x]}" "${SUBVOLIDS_ARRAY[$x]}" done printf "%4s) Exit\n" "0" read -e -r -p "Enter a number: " disk @@ -276,7 +276,7 @@ if [[ "$disk" == -1 ]]; then if [[ $disk == 0 ]]; then exit 0 fi - disk=$((disk-1)) + disk=$((disk - 1)) fi selected_subvolid="${SUBVOLIDS_ARRAY[$((disk))]}" @@ -289,7 +289,7 @@ else printf "The disk is mounted at '%s:%s'.\n" "$remote" "$selected_mnt" fi -# shellcheck source=/etc/default/snapper +# shellcheck source=/dev/null source "$SNAPPER_CONFIG" if [[ -z $selected_configs ]]; then @@ -322,17 +322,17 @@ for x in $selected_configs; do printf "'noconfirm' option passed. Failed backups will not be deleted.\n" else read -e -r -p "Delete failed backup snapshot(s)? (These local snapshots from failed backups are not used.) [y/N]? " delete_failed - while [[ -n "$delete_failed" && "$delete_failed" != [Yy]"es" && - "$delete_failed" != [Yy] && "$delete_failed" != [Nn]"o" && - "$delete_failed" != [Nn] ]]; do + while [[ -n $delete_failed && $delete_failed != [Yy]"es" && + $delete_failed != [Yy] && $delete_failed != [Nn]"o" && + $delete_failed != [Nn] ]]; do read -e -r -p "Delete failed backup snapshot(s)? (These local snapshots from failed backups are not used.) [y/N] " delete_failed - if [[ -n "$delete_failed" && "$delete_failed" != [Yy]"es" && - "$delete_failed" != [Yy] && "$delete_failed" != [Nn]"o" && - "$delete_failed" != [Nn] ]]; then + if [[ -n $delete_failed && $delete_failed != [Yy]"es" && + $delete_failed != [Yy] && $delete_failed != [Nn]"o" && + $delete_failed != [Nn] ]]; then printf "Select 'y' or 'N'.\n" fi done - if [[ "$delete_failed" == [Yy]"es" || "$delete_failed" == [Yy] ]]; then + if [[ $delete_failed == [Yy]"es" || $delete_failed == [Yy] ]]; then # explicit split list of snapshots (on whitespace) into multiple arguments # shellcheck disable=SC2046 snapper -c "$x" delete $(snapper -c "$x" list --disable-used-space | awk '/'$name' backup in progress/ {print $1}') @@ -343,7 +343,7 @@ for x in $selected_configs; do SNAP_SYNC_EXCLUDE=no if [[ -f "/etc/snapper/configs/$x" ]]; then - # shellcheck source=/etc/snapper/config-templates/default + # shellcheck source=/dev/null source "/etc/snapper/configs/$x" else die "Selected snapper configuration $x does not exist." @@ -358,10 +358,10 @@ for x in $selected_configs; do old_num=$(snapper -c "$x" list --disable-used-space -t single | awk '/'"subvolid=$selected_subvolid, uuid=$selected_uuid"'/ {print $1}') old_snap=$SUBVOLUME/.snapshots/$old_num/snapshot - OLD_NUM_ARRAY[$i]=$old_num - OLD_SNAP_ARRAY[$i]=$old_snap + OLD_NUM_ARRAY[i]=$old_num + OLD_SNAP_ARRAY[i]=$old_snap - if [[ -z "$old_num" ]]; then + if [[ -z $old_num ]]; then printf "No backups have been performed for '%s' on this disk.\n" "$x" read -e -r -p "Enter name of subvolume to store backups, relative to $selected_mnt (to be created if not existing): " mybackupdir printf "This will be the initial backup for snapper configuration '%s' to this disk. This could take awhile.\n" "$x" @@ -372,8 +372,8 @@ for x in $selected_configs; do BACKUPDIR="$selected_mnt/$mybackupdir" $ssh test -d "$BACKUPDIR" || die "%s is not a directory on %s.\n" "$BACKUPDIR" "$selected_uuid" fi - BACKUPDIRS_ARRAY[$i]="$BACKUPDIR" - MYBACKUPDIR_ARRAY[$i]="$mybackupdir" + BACKUPDIRS_ARRAY[i]="$BACKUPDIR" + MYBACKUPDIR_ARRAY[i]="$mybackupdir" printf "Creating new local snapshot for '%s' configuration...\n" "$x" new_num=$(snapper -c "$x" create --print-number -d "$name backup in progress") @@ -387,40 +387,40 @@ for x in $selected_configs; do printf "Will backup %s to %s\n" "$new_snap" "$remote":"$backup_location/snapshot" fi - if ($ssh test -d "$backup_location/snapshot") ; then + if ($ssh test -d "$backup_location/snapshot"); then printf "WARNING: Backup directory '%s' already exists. This configuration will be skipped!\n" "$backup_location/snapshot" printf "Move or delete destination directory and try backup again.\n" fi - NEW_NUM_ARRAY[$i]="$new_num" - NEW_SNAP_ARRAY[$i]="$new_snap" - NEW_INFO_ARRAY[$i]="$new_info" - BACKUPLOC_ARRAY[$i]="$backup_location" + NEW_NUM_ARRAY[i]="$new_num" + NEW_SNAP_ARRAY[i]="$new_snap" + NEW_INFO_ARRAY[i]="$new_info" + BACKUPLOC_ARRAY[i]="$backup_location" cont_backup="K" - CONT_BACKUP_ARRAY[$i]="yes" + CONT_BACKUP_ARRAY[i]="yes" if [[ $noconfirm == "yes" ]]; then cont_backup="yes" else - while [[ -n "$cont_backup" && "$cont_backup" != [Yy]"es" && - "$cont_backup" != [Yy] && "$cont_backup" != [Nn]"o" && - "$cont_backup" != [Nn] ]]; do + while [[ -n $cont_backup && $cont_backup != [Yy]"es" && + $cont_backup != [Yy] && $cont_backup != [Nn]"o" && + $cont_backup != [Nn] ]]; do read -e -r -p "Proceed with backup of '$x' configuration [Y/n]? " cont_backup - if [[ -n "$cont_backup" && "$cont_backup" != [Yy]"es" && - "$cont_backup" != [Yy] && "$cont_backup" != [Nn]"o" && - "$cont_backup" != [Nn] ]]; then + if [[ -n $cont_backup && $cont_backup != [Yy]"es" && + $cont_backup != [Yy] && $cont_backup != [Nn]"o" && + $cont_backup != [Nn] ]]; then printf "Select 'Y' or 'n'.\n" fi done fi - if [[ "$cont_backup" != [Yy]"es" && "$cont_backup" != [Yy] && -n "$cont_backup" ]]; then - CONT_BACKUP_ARRAY[$i]="no" + if [[ $cont_backup != [Yy]"es" && $cont_backup != [Yy] && -n $cont_backup ]]; then + CONT_BACKUP_ARRAY[i]="no" printf "Not backing up '%s' configuration.\n" "$x" snapper -c "$x" delete "$new_num" fi - i=$((i+1)) + i=$((i + 1)) done @@ -429,12 +429,12 @@ printf "\nPerforming backups...\n" i=-1 for x in $selected_configs; do - i=$((i+1)) + i=$((i + 1)) SNAP_SYNC_EXCLUDE=no if [[ -f "/etc/snapper/configs/$x" ]]; then - # shellcheck source=/etc/snapper/config-templates/default + # shellcheck source=/dev/null source "/etc/snapper/configs/$x" else die "Selected snapper configuration $x does not exist." @@ -459,14 +459,14 @@ for x in $selected_configs; do new_info="${NEW_INFO_ARRAY[$i]}" backup_location="${BACKUPLOC_ARRAY[$i]}" - if ($ssh test -d "$backup_location/snapshot") ; then + if ($ssh test -d "$backup_location/snapshot"); then printf "ERROR: Backup directory '%s' already exists. Skipping backup of this configuration!\n" "$backup_location/snapshot" continue fi $ssh mkdir -p "$backup_location" - if [[ -z "$old_num" ]]; then + if [[ -z $old_num ]]; then printf "Sending first snapshot for '%s' configuration...\n" "$x" if [[ $doprogress -eq 0 ]]; then btrfs send "$new_snap" | pv | $ssh btrfs receive "$backup_location" &>/dev/null @@ -522,7 +522,7 @@ done printf "\nDone!\n" -if [[ "$uuid_cmdline" != "none" ]]; then +if [[ $uuid_cmdline != "none" ]]; then notify_info "Finished" "Backups to $uuid_cmdline complete!" else notify_info "Finished" "Backups complete!" diff --git a/sys/nixpkgs/pkgs/tree-sitter-yts/Cargo.toml b/sys/nixpkgs/pkgs/tree-sitter-yts/Cargo.toml index 9756d2fe..5287c420 100644 --- a/sys/nixpkgs/pkgs/tree-sitter-yts/Cargo.toml +++ b/sys/nixpkgs/pkgs/tree-sitter-yts/Cargo.toml @@ -9,12 +9,7 @@ edition = "2018" license = "MIT" build = "bindings/rust/build.rs" -include = [ - "bindings/rust/*", - "grammar.js", - "queries/*", - "src/*", -] +include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"] [lib] path = "bindings/rust/lib.rs" diff --git a/sys/nixpkgs/pkgs/tree-sitter-yts/bindings/node/binding.cc b/sys/nixpkgs/pkgs/tree-sitter-yts/bindings/node/binding.cc index de7d0497..a042be54 100644 --- a/sys/nixpkgs/pkgs/tree-sitter-yts/bindings/node/binding.cc +++ b/sys/nixpkgs/pkgs/tree-sitter-yts/bindings/node/binding.cc @@ -1,28 +1,33 @@ +#include "nan.h" #include "tree_sitter/parser.h" #include <node.h> -#include "nan.h" using namespace v8; -extern "C" TSLanguage * tree_sitter_yts(); +extern "C" TSLanguage *tree_sitter_yts (); -namespace { +namespace +{ -NAN_METHOD(New) {} +NAN_METHOD (New) {} -void Init(Local<Object> exports, Local<Object> module) { - Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New); - tpl->SetClassName(Nan::New("Language").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); +void +Init (Local<Object> exports, Local<Object> module) +{ + Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate> (New); + tpl->SetClassName (Nan::New ("Language").ToLocalChecked ()); + tpl->InstanceTemplate ()->SetInternalFieldCount (1); - Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked(); - Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); - Nan::SetInternalFieldPointer(instance, 0, tree_sitter_yts()); + Local<Function> constructor = Nan::GetFunction (tpl).ToLocalChecked (); + Local<Object> instance + = constructor->NewInstance (Nan::GetCurrentContext ()).ToLocalChecked (); + Nan::SetInternalFieldPointer (instance, 0, tree_sitter_yts ()); - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("yts").ToLocalChecked()); - Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); + Nan::Set (instance, Nan::New ("name").ToLocalChecked (), + Nan::New ("yts").ToLocalChecked ()); + Nan::Set (module, Nan::New ("exports").ToLocalChecked (), instance); } -NODE_MODULE(tree_sitter_yts_binding, Init) +NODE_MODULE (tree_sitter_yts_binding, Init) -} // namespace +} // namespace diff --git a/sys/nixpkgs/pkgs/tree-sitter-yts/src/parser.c b/sys/nixpkgs/pkgs/tree-sitter-yts/src/parser.c index 5b02c3d0..ded5c342 100644 --- a/sys/nixpkgs/pkgs/tree-sitter-yts/src/parser.c +++ b/sys/nixpkgs/pkgs/tree-sitter-yts/src/parser.c @@ -16,7 +16,8 @@ #define MAX_ALIAS_SEQUENCE_LENGTH 8 #define PRODUCTION_ID_COUNT 1 -enum { +enum +{ anon_sym_LF = 1, anon_sym_pick = 2, anon_sym_p = 3, @@ -48,7 +49,7 @@ enum { aux_sym_source_file_repeat1 = 29, }; -static const char * const ts_symbol_names[] = { +static const char *const ts_symbol_names[] = { [ts_builtin_sym_end] = "end", [anon_sym_LF] = "\n", [anon_sym_pick] = "pick", @@ -237,409 +238,474 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { }, }; -static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { - [0] = {0}, -}; +static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT] + [MAX_ALIAS_SEQUENCE_LENGTH] + = { + [0] = { 0 }, + }; static const uint16_t ts_non_terminal_alias_map[] = { 0, }; static const TSStateId ts_primary_state_ids[STATE_COUNT] = { - [0] = 0, - [1] = 1, - [2] = 2, - [3] = 3, - [4] = 4, - [5] = 5, - [6] = 6, - [7] = 7, - [8] = 8, - [9] = 9, - [10] = 10, - [11] = 11, - [12] = 12, - [13] = 13, - [14] = 14, - [15] = 15, - [16] = 16, - [17] = 17, - [18] = 18, - [19] = 19, - [20] = 20, - [21] = 21, - [22] = 22, - [23] = 23, - [24] = 24, - [25] = 25, - [26] = 26, - [27] = 27, - [28] = 28, - [29] = 29, - [30] = 30, + [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, + [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13, + [14] = 14, [15] = 15, [16] = 16, [17] = 17, [18] = 18, [19] = 19, [20] = 20, + [21] = 21, [22] = 22, [23] = 23, [24] = 24, [25] = 25, [26] = 26, [27] = 27, + [28] = 28, [29] = 29, [30] = 30, }; -static bool ts_lex(TSLexer *lexer, TSStateId state) { - START_LEXER(); - eof = lexer->eof(lexer); - switch (state) { +static bool +ts_lex (TSLexer *lexer, TSStateId state) +{ + START_LEXER (); + eof = lexer->eof (lexer); + switch (state) + { case 0: - if (eof) ADVANCE(47); - if (lookahead == '"') ADVANCE(74); - if (lookahead == '#') ADVANCE(73); - if (lookahead == 'N') ADVANCE(30); - if (lookahead == '[') ADVANCE(68); - if (lookahead == '\\') SKIP(46) - if (lookahead == ']') ADVANCE(72); - if (lookahead == 'd') ADVANCE(54); - if (lookahead == 'p') ADVANCE(50); - if (lookahead == 'u') ADVANCE(56); - if (lookahead == 'w') ADVANCE(52); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(0) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(60); - END_STATE(); + if (eof) + ADVANCE (47); + if (lookahead == '"') + ADVANCE (74); + if (lookahead == '#') + ADVANCE (73); + if (lookahead == 'N') + ADVANCE (30); + if (lookahead == '[') + ADVANCE (68); + if (lookahead == '\\') + SKIP (46) + if (lookahead == ']') + ADVANCE (72); + if (lookahead == 'd') + ADVANCE (54); + if (lookahead == 'p') + ADVANCE (50); + if (lookahead == 'u') + ADVANCE (56); + if (lookahead == 'w') + ADVANCE (52); + if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' + || lookahead == ' ') + SKIP (0) + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (60); + END_STATE (); case 1: - if (lookahead == '\n') SKIP(14) - END_STATE(); + if (lookahead == '\n') + SKIP (14) + END_STATE (); case 2: - if (lookahead == '\n') SKIP(14) - if (lookahead == '\r') SKIP(1) - END_STATE(); + if (lookahead == '\n') + SKIP (14) + if (lookahead == '\r') + SKIP (1) + END_STATE (); case 3: - if (lookahead == '\n') SKIP(16) - END_STATE(); + if (lookahead == '\n') + SKIP (16) + END_STATE (); case 4: - if (lookahead == '\n') SKIP(16) - if (lookahead == '\r') SKIP(3) - END_STATE(); + if (lookahead == '\n') + SKIP (16) + if (lookahead == '\r') + SKIP (3) + END_STATE (); case 5: - if (lookahead == '\n') SKIP(7) - END_STATE(); + if (lookahead == '\n') + SKIP (7) + END_STATE (); case 6: - if (lookahead == '\n') SKIP(7) - if (lookahead == '\r') SKIP(5) - END_STATE(); + if (lookahead == '\n') + SKIP (7) + if (lookahead == '\r') + SKIP (5) + END_STATE (); case 7: - if (lookahead == '\n') ADVANCE(48); - if (lookahead == '\\') SKIP(6) - if (lookahead == '\t' || - lookahead == '\r' || - lookahead == ' ') SKIP(7) - END_STATE(); + if (lookahead == '\n') + ADVANCE (48); + if (lookahead == '\\') + SKIP (6) + if (lookahead == '\t' || lookahead == '\r' || lookahead == ' ') + SKIP (7) + END_STATE (); case 8: - if (lookahead == ' ') ADVANCE(13); - END_STATE(); + if (lookahead == ' ') + ADVANCE (13); + END_STATE (); case 9: - if (lookahead == ' ') ADVANCE(39); - END_STATE(); + if (lookahead == ' ') + ADVANCE (39); + END_STATE (); case 10: - if (lookahead == ' ') ADVANCE(40); - END_STATE(); + if (lookahead == ' ') + ADVANCE (40); + END_STATE (); case 11: - if (lookahead == '-') ADVANCE(43); - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(24); - END_STATE(); + if (lookahead == '-') + ADVANCE (43); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (24); + END_STATE (); case 12: - if (lookahead == '-') ADVANCE(44); - END_STATE(); + if (lookahead == '-') + ADVANCE (44); + END_STATE (); case 13: - if (lookahead == 'D') ADVANCE(38); - END_STATE(); + if (lookahead == 'D') + ADVANCE (38); + END_STATE (); case 14: - if (lookahead == 'N') ADVANCE(30); - if (lookahead == '\\') SKIP(2) - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(14) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(23); - END_STATE(); + if (lookahead == 'N') + ADVANCE (30); + if (lookahead == '\\') + SKIP (2) + if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' + || lookahead == ' ') + SKIP (14) + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (23); + END_STATE (); case 15: - if (lookahead == '\\') ADVANCE(63); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(65); - if (lookahead != 0 && - lookahead != '"') ADVANCE(66); - END_STATE(); + if (lookahead == '\\') + ADVANCE (63); + if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' + || lookahead == ' ') + ADVANCE (65); + if (lookahead != 0 && lookahead != '"') + ADVANCE (66); + END_STATE (); case 16: - if (lookahead == '\\') SKIP(4) - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(16) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(62); - END_STATE(); + if (lookahead == '\\') + SKIP (4) + if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' + || lookahead == ' ') + SKIP (16) + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (62); + END_STATE (); case 17: - if (lookahead == 'a') ADVANCE(36); - END_STATE(); + if (lookahead == 'a') + ADVANCE (36); + END_STATE (); case 18: - if (lookahead == 'c') ADVANCE(26); - END_STATE(); + if (lookahead == 'c') + ADVANCE (26); + END_STATE (); case 19: - if (lookahead == 'c') ADVANCE(20); - END_STATE(); + if (lookahead == 'c') + ADVANCE (20); + END_STATE (); case 20: - if (lookahead == 'h') ADVANCE(51); - END_STATE(); + if (lookahead == 'h') + ADVANCE (51); + END_STATE (); case 21: - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(11); - END_STATE(); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (11); + END_STATE (); case 22: - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(21); - END_STATE(); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (21); + END_STATE (); case 23: - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(22); - END_STATE(); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (22); + END_STATE (); case 24: - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(24); - END_STATE(); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (24); + END_STATE (); case 25: - if (lookahead == 'i') ADVANCE(32); - END_STATE(); + if (lookahead == 'i') + ADVANCE (32); + END_STATE (); case 26: - if (lookahead == 'k') ADVANCE(49); - END_STATE(); + if (lookahead == 'k') + ADVANCE (49); + END_STATE (); case 27: - if (lookahead == 'l') ADVANCE(55); - END_STATE(); + if (lookahead == 'l') + ADVANCE (55); + END_STATE (); case 28: - if (lookahead == 'm') ADVANCE(71); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(28); - END_STATE(); + if (lookahead == 'm') + ADVANCE (71); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (28); + END_STATE (); case 29: - if (lookahead == 'n') ADVANCE(69); - END_STATE(); + if (lookahead == 'n') + ADVANCE (69); + END_STATE (); case 30: - if (lookahead == 'o') ADVANCE(8); - END_STATE(); + if (lookahead == 'o') + ADVANCE (8); + END_STATE (); case 31: - if (lookahead == 'o') ADVANCE(33); - END_STATE(); + if (lookahead == 'o') + ADVANCE (33); + END_STATE (); case 32: - if (lookahead == 'o') ADVANCE(29); - END_STATE(); + if (lookahead == 'o') + ADVANCE (29); + END_STATE (); case 33: - if (lookahead == 'p') ADVANCE(53); - END_STATE(); + if (lookahead == 'p') + ADVANCE (53); + END_STATE (); case 34: - if (lookahead == 'r') ADVANCE(17); - END_STATE(); + if (lookahead == 'r') + ADVANCE (17); + END_STATE (); case 35: - if (lookahead == 's') ADVANCE(70); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(35); - END_STATE(); + if (lookahead == 's') + ADVANCE (70); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (35); + END_STATE (); case 36: - if (lookahead == 't') ADVANCE(25); - END_STATE(); + if (lookahead == 't') + ADVANCE (25); + END_STATE (); case 37: - if (lookahead == 't') ADVANCE(19); - END_STATE(); + if (lookahead == 't') + ADVANCE (19); + END_STATE (); case 38: - if (lookahead == 'u') ADVANCE(34); - END_STATE(); + if (lookahead == 'u') + ADVANCE (34); + END_STATE (); case 39: - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(28); - END_STATE(); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (28); + END_STATE (); case 40: - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(35); - END_STATE(); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (35); + END_STATE (); case 41: - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(12); - END_STATE(); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (12); + END_STATE (); case 42: - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(67); - END_STATE(); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (67); + END_STATE (); case 43: - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(41); - END_STATE(); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (41); + END_STATE (); case 44: - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(42); - END_STATE(); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (42); + END_STATE (); case 45: - if (eof) ADVANCE(47); - if (lookahead == '\n') SKIP(0) - END_STATE(); + if (eof) + ADVANCE (47); + if (lookahead == '\n') + SKIP (0) + END_STATE (); case 46: - if (eof) ADVANCE(47); - if (lookahead == '\n') SKIP(0) - if (lookahead == '\r') SKIP(45) - END_STATE(); + if (eof) + ADVANCE (47); + if (lookahead == '\n') + SKIP (0) + if (lookahead == '\r') + SKIP (45) + END_STATE (); case 47: - ACCEPT_TOKEN(ts_builtin_sym_end); - END_STATE(); + ACCEPT_TOKEN (ts_builtin_sym_end); + END_STATE (); case 48: - ACCEPT_TOKEN(anon_sym_LF); - if (lookahead == '\n') ADVANCE(48); - END_STATE(); + ACCEPT_TOKEN (anon_sym_LF); + if (lookahead == '\n') + ADVANCE (48); + END_STATE (); case 49: - ACCEPT_TOKEN(anon_sym_pick); - END_STATE(); + ACCEPT_TOKEN (anon_sym_pick); + END_STATE (); case 50: - ACCEPT_TOKEN(anon_sym_p); - if (lookahead == 'i') ADVANCE(18); - END_STATE(); + ACCEPT_TOKEN (anon_sym_p); + if (lookahead == 'i') + ADVANCE (18); + END_STATE (); case 51: - ACCEPT_TOKEN(anon_sym_watch); - END_STATE(); + ACCEPT_TOKEN (anon_sym_watch); + END_STATE (); case 52: - ACCEPT_TOKEN(anon_sym_w); - if (lookahead == 'a') ADVANCE(37); - END_STATE(); + ACCEPT_TOKEN (anon_sym_w); + if (lookahead == 'a') + ADVANCE (37); + END_STATE (); case 53: - ACCEPT_TOKEN(anon_sym_drop); - END_STATE(); + ACCEPT_TOKEN (anon_sym_drop); + END_STATE (); case 54: - ACCEPT_TOKEN(anon_sym_d); - if (lookahead == 'r') ADVANCE(31); - END_STATE(); + ACCEPT_TOKEN (anon_sym_d); + if (lookahead == 'r') + ADVANCE (31); + END_STATE (); case 55: - ACCEPT_TOKEN(anon_sym_url); - END_STATE(); + ACCEPT_TOKEN (anon_sym_url); + END_STATE (); case 56: - ACCEPT_TOKEN(anon_sym_u); - if (lookahead == 'r') ADVANCE(27); - END_STATE(); + ACCEPT_TOKEN (anon_sym_u); + if (lookahead == 'r') + ADVANCE (27); + END_STATE (); case 57: - ACCEPT_TOKEN(sym_id); - if (lookahead == '-') ADVANCE(43); - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(61); - END_STATE(); + ACCEPT_TOKEN (sym_id); + if (lookahead == '-') + ADVANCE (43); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (61); + END_STATE (); case 58: - ACCEPT_TOKEN(sym_id); - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(57); - END_STATE(); + ACCEPT_TOKEN (sym_id); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (57); + END_STATE (); case 59: - ACCEPT_TOKEN(sym_id); - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(58); - END_STATE(); + ACCEPT_TOKEN (sym_id); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (58); + END_STATE (); case 60: - ACCEPT_TOKEN(sym_id); - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(59); - END_STATE(); + ACCEPT_TOKEN (sym_id); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (59); + END_STATE (); case 61: - ACCEPT_TOKEN(sym_id); - if (lookahead == 'h') ADVANCE(9); - if (lookahead == 'm') ADVANCE(10); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(61); - END_STATE(); + ACCEPT_TOKEN (sym_id); + if (lookahead == 'h') + ADVANCE (9); + if (lookahead == 'm') + ADVANCE (10); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (61); + END_STATE (); case 62: - ACCEPT_TOKEN(sym_id); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(62); - END_STATE(); + ACCEPT_TOKEN (sym_id); + if (('0' <= lookahead && lookahead <= '9')) + ADVANCE (62); + END_STATE (); case 63: - ACCEPT_TOKEN(aux_sym_title_token1); - if (lookahead == '\n') ADVANCE(65); - if (lookahead == '\r') ADVANCE(64); - if (lookahead != 0 && - lookahead != '"') ADVANCE(66); - END_STATE(); + ACCEPT_TOKEN (aux_sym_title_token1); + if (lookahead == '\n') + ADVANCE (65); + if (lookahead == '\r') + ADVANCE (64); + if (lookahead != 0 && lookahead != '"') + ADVANCE (66); + END_STATE (); case 64: - ACCEPT_TOKEN(aux_sym_title_token1); - if (lookahead == '\n') ADVANCE(65); - if (lookahead != 0 && - lookahead != '"') ADVANCE(66); - END_STATE(); + ACCEPT_TOKEN (aux_sym_title_token1); + if (lookahead == '\n') + ADVANCE (65); + if (lookahead != 0 && lookahead != '"') + ADVANCE (66); + END_STATE (); case 65: - ACCEPT_TOKEN(aux_sym_title_token1); - if (lookahead == '\\') ADVANCE(63); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(65); - if (lookahead != 0 && - lookahead != '"') ADVANCE(66); - END_STATE(); + ACCEPT_TOKEN (aux_sym_title_token1); + if (lookahead == '\\') + ADVANCE (63); + if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' + || lookahead == ' ') + ADVANCE (65); + if (lookahead != 0 && lookahead != '"') + ADVANCE (66); + END_STATE (); case 66: - ACCEPT_TOKEN(aux_sym_title_token1); - if (lookahead != 0 && - lookahead != '"') ADVANCE(66); - END_STATE(); + ACCEPT_TOKEN (aux_sym_title_token1); + if (lookahead != 0 && lookahead != '"') + ADVANCE (66); + END_STATE (); case 67: - ACCEPT_TOKEN(aux_sym_date_token1); - END_STATE(); + ACCEPT_TOKEN (aux_sym_date_token1); + END_STATE (); case 68: - ACCEPT_TOKEN(anon_sym_LBRACK); - END_STATE(); + ACCEPT_TOKEN (anon_sym_LBRACK); + END_STATE (); case 69: - ACCEPT_TOKEN(anon_sym_NoDuration); - END_STATE(); + ACCEPT_TOKEN (anon_sym_NoDuration); + END_STATE (); case 70: - ACCEPT_TOKEN(aux_sym_duration_token1); - END_STATE(); + ACCEPT_TOKEN (aux_sym_duration_token1); + END_STATE (); case 71: - ACCEPT_TOKEN(aux_sym_duration_token2); - END_STATE(); + ACCEPT_TOKEN (aux_sym_duration_token2); + END_STATE (); case 72: - ACCEPT_TOKEN(anon_sym_RBRACK); - END_STATE(); + ACCEPT_TOKEN (anon_sym_RBRACK); + END_STATE (); case 73: - ACCEPT_TOKEN(sym_comment); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(73); - END_STATE(); + ACCEPT_TOKEN (sym_comment); + if (lookahead != 0 && lookahead != '\n') + ADVANCE (73); + END_STATE (); case 74: - ACCEPT_TOKEN(sym_quote); - END_STATE(); + ACCEPT_TOKEN (sym_quote); + END_STATE (); default: return false; - } + } } static const TSLexMode ts_lex_modes[STATE_COUNT] = { - [0] = {.lex_state = 0}, - [1] = {.lex_state = 0}, - [2] = {.lex_state = 0}, - [3] = {.lex_state = 0}, - [4] = {.lex_state = 0}, - [5] = {.lex_state = 0}, - [6] = {.lex_state = 0}, - [7] = {.lex_state = 0}, - [8] = {.lex_state = 14}, - [9] = {.lex_state = 0}, - [10] = {.lex_state = 0}, - [11] = {.lex_state = 0}, - [12] = {.lex_state = 0}, - [13] = {.lex_state = 0}, - [14] = {.lex_state = 0}, - [15] = {.lex_state = 0}, - [16] = {.lex_state = 15}, - [17] = {.lex_state = 0}, - [18] = {.lex_state = 0}, - [19] = {.lex_state = 16}, - [20] = {.lex_state = 0}, - [21] = {.lex_state = 7}, - [22] = {.lex_state = 15}, - [23] = {.lex_state = 14}, - [24] = {.lex_state = 0}, - [25] = {.lex_state = 15}, - [26] = {.lex_state = 16}, - [27] = {.lex_state = 0}, - [28] = {.lex_state = 7}, - [29] = {.lex_state = 0}, - [30] = {.lex_state = 0}, + [0] = { .lex_state = 0 }, [1] = { .lex_state = 0 }, + [2] = { .lex_state = 0 }, [3] = { .lex_state = 0 }, + [4] = { .lex_state = 0 }, [5] = { .lex_state = 0 }, + [6] = { .lex_state = 0 }, [7] = { .lex_state = 0 }, + [8] = { .lex_state = 14 }, [9] = { .lex_state = 0 }, + [10] = { .lex_state = 0 }, [11] = { .lex_state = 0 }, + [12] = { .lex_state = 0 }, [13] = { .lex_state = 0 }, + [14] = { .lex_state = 0 }, [15] = { .lex_state = 0 }, + [16] = { .lex_state = 15 }, [17] = { .lex_state = 0 }, + [18] = { .lex_state = 0 }, [19] = { .lex_state = 16 }, + [20] = { .lex_state = 0 }, [21] = { .lex_state = 7 }, + [22] = { .lex_state = 15 }, [23] = { .lex_state = 14 }, + [24] = { .lex_state = 0 }, [25] = { .lex_state = 15 }, + [26] = { .lex_state = 16 }, [27] = { .lex_state = 0 }, + [28] = { .lex_state = 7 }, [29] = { .lex_state = 0 }, + [30] = { .lex_state = 0 }, }; static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { @@ -683,279 +749,360 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { static const uint16_t ts_small_parse_table[] = { [0] = 6, - ACTIONS(11), 1, - ts_builtin_sym_end, - ACTIONS(13), 1, - sym_comment, - STATE(26), 1, - sym_command, - STATE(3), 2, - sym_line, - aux_sym_source_file_repeat1, - ACTIONS(5), 4, - anon_sym_pick, - anon_sym_watch, - anon_sym_drop, - anon_sym_url, - ACTIONS(7), 4, - anon_sym_p, - anon_sym_w, - anon_sym_d, - anon_sym_u, + ACTIONS (11), + 1, + ts_builtin_sym_end, + ACTIONS (13), + 1, + sym_comment, + STATE (26), + 1, + sym_command, + STATE (3), + 2, + sym_line, + aux_sym_source_file_repeat1, + ACTIONS (5), + 4, + anon_sym_pick, + anon_sym_watch, + anon_sym_drop, + anon_sym_url, + ACTIONS (7), + 4, + anon_sym_p, + anon_sym_w, + anon_sym_d, + anon_sym_u, [26] = 6, - ACTIONS(15), 1, - ts_builtin_sym_end, - ACTIONS(23), 1, - sym_comment, - STATE(26), 1, - sym_command, - STATE(3), 2, - sym_line, - aux_sym_source_file_repeat1, - ACTIONS(17), 4, - anon_sym_pick, - anon_sym_watch, - anon_sym_drop, - anon_sym_url, - ACTIONS(20), 4, - anon_sym_p, - anon_sym_w, - anon_sym_d, - anon_sym_u, + ACTIONS (15), + 1, + ts_builtin_sym_end, + ACTIONS (23), + 1, + sym_comment, + STATE (26), + 1, + sym_command, + STATE (3), + 2, + sym_line, + aux_sym_source_file_repeat1, + ACTIONS (17), + 4, + anon_sym_pick, + anon_sym_watch, + anon_sym_drop, + anon_sym_url, + ACTIONS (20), + 4, + anon_sym_p, + anon_sym_w, + anon_sym_d, + anon_sym_u, [52] = 2, - ACTIONS(28), 4, - anon_sym_p, - anon_sym_w, - anon_sym_d, - anon_sym_u, - ACTIONS(26), 6, - ts_builtin_sym_end, - anon_sym_pick, - anon_sym_watch, - anon_sym_drop, - anon_sym_url, - sym_comment, + ACTIONS (28), + 4, + anon_sym_p, + anon_sym_w, + anon_sym_d, + anon_sym_u, + ACTIONS (26), + 6, + ts_builtin_sym_end, + anon_sym_pick, + anon_sym_watch, + anon_sym_drop, + anon_sym_url, + sym_comment, [67] = 3, - ACTIONS(30), 1, - sym_quote, - STATE(21), 1, - sym_url, - STATE(22), 1, - sym__q, + ACTIONS (30), + 1, + sym_quote, + STATE (21), + 1, + sym_url, + STATE (22), + 1, + sym__q, [77] = 3, - ACTIONS(32), 1, - sym_quote, - STATE(7), 1, - sym_title, - STATE(25), 1, - sym__q, + ACTIONS (32), + 1, + sym_quote, + STATE (7), + 1, + sym_title, + STATE (25), + 1, + sym__q, [87] = 3, - ACTIONS(34), 1, - sym_quote, - STATE(9), 1, - sym_date, - STATE(23), 1, - sym__q, + ACTIONS (34), + 1, + sym_quote, + STATE (9), + 1, + sym_date, + STATE (23), + 1, + sym__q, [97] = 1, - ACTIONS(36), 3, - anon_sym_NoDuration, - aux_sym_duration_token1, - aux_sym_duration_token2, + ACTIONS (36), + 3, + anon_sym_NoDuration, + aux_sym_duration_token1, + aux_sym_duration_token2, [103] = 3, - ACTIONS(38), 1, - sym_quote, - STATE(10), 1, - sym_author, - STATE(16), 1, - sym__q, + ACTIONS (38), + 1, + sym_quote, + STATE (10), + 1, + sym_author, + STATE (16), + 1, + sym__q, [113] = 3, - ACTIONS(40), 1, - sym_quote, - STATE(5), 1, - sym_duration, - STATE(18), 1, - sym__q, + ACTIONS (40), + 1, + sym_quote, + STATE (5), + 1, + sym_duration, + STATE (18), + 1, + sym__q, [123] = 2, - ACTIONS(42), 1, - sym_quote, - STATE(30), 1, - sym__q, + ACTIONS (42), + 1, + sym_quote, + STATE (30), + 1, + sym__q, [130] = 2, - ACTIONS(44), 1, - sym_quote, - STATE(28), 1, - sym__q, + ACTIONS (44), + 1, + sym_quote, + STATE (28), + 1, + sym__q, [137] = 2, - ACTIONS(46), 1, - sym_quote, - STATE(24), 1, - sym__q, + ACTIONS (46), + 1, + sym_quote, + STATE (24), + 1, + sym__q, [144] = 2, - ACTIONS(48), 1, - sym_quote, - STATE(17), 1, - sym__q, + ACTIONS (48), + 1, + sym_quote, + STATE (17), + 1, + sym__q, [151] = 2, - ACTIONS(50), 1, - sym_quote, - STATE(20), 1, - sym__q, + ACTIONS (50), + 1, + sym_quote, + STATE (20), + 1, + sym__q, [158] = 1, - ACTIONS(52), 1, - aux_sym_title_token1, + ACTIONS (52), + 1, + aux_sym_title_token1, [162] = 1, - ACTIONS(54), 1, - sym_quote, + ACTIONS (54), + 1, + sym_quote, [166] = 1, - ACTIONS(56), 1, - anon_sym_LBRACK, + ACTIONS (56), + 1, + anon_sym_LBRACK, [170] = 1, - ACTIONS(58), 1, - sym_id, + ACTIONS (58), + 1, + sym_id, [174] = 1, - ACTIONS(60), 1, - sym_quote, + ACTIONS (60), + 1, + sym_quote, [178] = 1, - ACTIONS(62), 1, - anon_sym_LF, + ACTIONS (62), + 1, + anon_sym_LF, [182] = 1, - ACTIONS(64), 1, - aux_sym_title_token1, + ACTIONS (64), + 1, + aux_sym_title_token1, [186] = 1, - ACTIONS(66), 1, - aux_sym_date_token1, + ACTIONS (66), + 1, + aux_sym_date_token1, [190] = 1, - ACTIONS(68), 1, - sym_quote, + ACTIONS (68), + 1, + sym_quote, [194] = 1, - ACTIONS(70), 1, - aux_sym_title_token1, + ACTIONS (70), + 1, + aux_sym_title_token1, [198] = 1, - ACTIONS(72), 1, - sym_id, + ACTIONS (72), + 1, + sym_id, [202] = 1, - ACTIONS(74), 1, - anon_sym_RBRACK, + ACTIONS (74), + 1, + anon_sym_RBRACK, [206] = 1, - ACTIONS(76), 1, - anon_sym_LF, + ACTIONS (76), + 1, + anon_sym_LF, [210] = 1, - ACTIONS(78), 1, - ts_builtin_sym_end, + ACTIONS (78), + 1, + ts_builtin_sym_end, [214] = 1, - ACTIONS(80), 1, - sym_quote, + ACTIONS (80), + 1, + sym_quote, }; static const uint32_t ts_small_parse_table_map[] = { - [SMALL_STATE(2)] = 0, - [SMALL_STATE(3)] = 26, - [SMALL_STATE(4)] = 52, - [SMALL_STATE(5)] = 67, - [SMALL_STATE(6)] = 77, - [SMALL_STATE(7)] = 87, - [SMALL_STATE(8)] = 97, - [SMALL_STATE(9)] = 103, - [SMALL_STATE(10)] = 113, - [SMALL_STATE(11)] = 123, - [SMALL_STATE(12)] = 130, - [SMALL_STATE(13)] = 137, - [SMALL_STATE(14)] = 144, - [SMALL_STATE(15)] = 151, - [SMALL_STATE(16)] = 158, - [SMALL_STATE(17)] = 162, - [SMALL_STATE(18)] = 166, - [SMALL_STATE(19)] = 170, - [SMALL_STATE(20)] = 174, - [SMALL_STATE(21)] = 178, - [SMALL_STATE(22)] = 182, - [SMALL_STATE(23)] = 186, - [SMALL_STATE(24)] = 190, - [SMALL_STATE(25)] = 194, - [SMALL_STATE(26)] = 198, - [SMALL_STATE(27)] = 202, - [SMALL_STATE(28)] = 206, - [SMALL_STATE(29)] = 210, - [SMALL_STATE(30)] = 214, + [SMALL_STATE (2)] = 0, [SMALL_STATE (3)] = 26, [SMALL_STATE (4)] = 52, + [SMALL_STATE (5)] = 67, [SMALL_STATE (6)] = 77, [SMALL_STATE (7)] = 87, + [SMALL_STATE (8)] = 97, [SMALL_STATE (9)] = 103, [SMALL_STATE (10)] = 113, + [SMALL_STATE (11)] = 123, [SMALL_STATE (12)] = 130, [SMALL_STATE (13)] = 137, + [SMALL_STATE (14)] = 144, [SMALL_STATE (15)] = 151, [SMALL_STATE (16)] = 158, + [SMALL_STATE (17)] = 162, [SMALL_STATE (18)] = 166, [SMALL_STATE (19)] = 170, + [SMALL_STATE (20)] = 174, [SMALL_STATE (21)] = 178, [SMALL_STATE (22)] = 182, + [SMALL_STATE (23)] = 186, [SMALL_STATE (24)] = 190, [SMALL_STATE (25)] = 194, + [SMALL_STATE (26)] = 198, [SMALL_STATE (27)] = 202, [SMALL_STATE (28)] = 206, + [SMALL_STATE (29)] = 210, [SMALL_STATE (30)] = 214, }; static const TSParseActionEntry ts_parse_actions[] = { - [0] = {.entry = {.count = 0, .reusable = false}}, - [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), - [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0), - [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), - [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), - [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [11] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), - [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), - [17] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(19), - [20] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(19), - [23] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(3), - [26] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_line, 8), - [28] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_line, 8), - [30] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), - [32] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), - [34] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), - [36] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), - [38] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), - [40] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), - [42] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), - [44] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), - [46] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), - [48] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), - [50] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), - [52] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), - [54] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_title, 3), - [56] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [58] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 1), - [60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_date, 3), - [62] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), - [64] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), - [66] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), - [68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_author, 3), - [70] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), - [72] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), - [74] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), - [76] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_url, 3), - [78] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_duration, 5), + [0] = { .entry = { .count = 0, .reusable = false } }, + [1] = { .entry = { .count = 1, .reusable = false } }, + RECOVER (), + [3] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (sym_source_file, 0), + [5] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (19), + [7] = { .entry = { .count = 1, .reusable = false } }, + SHIFT (19), + [9] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (2), + [11] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (sym_source_file, 1), + [13] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (3), + [15] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (aux_sym_source_file_repeat1, 2), + [17] = { .entry = { .count = 2, .reusable = true } }, + REDUCE (aux_sym_source_file_repeat1, 2), + SHIFT_REPEAT (19), + [20] = { .entry = { .count = 2, .reusable = false } }, + REDUCE (aux_sym_source_file_repeat1, 2), + SHIFT_REPEAT (19), + [23] = { .entry = { .count = 2, .reusable = true } }, + REDUCE (aux_sym_source_file_repeat1, 2), + SHIFT_REPEAT (3), + [26] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (sym_line, 8), + [28] = { .entry = { .count = 1, .reusable = false } }, + REDUCE (sym_line, 8), + [30] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (22), + [32] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (25), + [34] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (23), + [36] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (27), + [38] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (16), + [40] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (18), + [42] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (30), + [44] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (28), + [46] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (24), + [48] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (17), + [50] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (20), + [52] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (13), + [54] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (sym_title, 3), + [56] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (8), + [58] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (sym_command, 1), + [60] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (sym_date, 3), + [62] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (4), + [64] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (12), + [66] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (15), + [68] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (sym_author, 3), + [70] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (14), + [72] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (6), + [74] = { .entry = { .count = 1, .reusable = true } }, + SHIFT (11), + [76] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (sym_url, 3), + [78] = { .entry = { .count = 1, .reusable = true } }, + ACCEPT_INPUT (), + [80] = { .entry = { .count = 1, .reusable = true } }, + REDUCE (sym_duration, 5), }; #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif #ifdef _WIN32 -#define extern __declspec(dllexport) +#define extern __declspec (dllexport) #endif -extern const TSLanguage *tree_sitter_yts(void) { - static const TSLanguage language = { - .version = LANGUAGE_VERSION, - .symbol_count = SYMBOL_COUNT, - .alias_count = ALIAS_COUNT, - .token_count = TOKEN_COUNT, - .external_token_count = EXTERNAL_TOKEN_COUNT, - .state_count = STATE_COUNT, - .large_state_count = LARGE_STATE_COUNT, - .production_id_count = PRODUCTION_ID_COUNT, - .field_count = FIELD_COUNT, - .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, - .parse_table = &ts_parse_table[0][0], - .small_parse_table = ts_small_parse_table, - .small_parse_table_map = ts_small_parse_table_map, - .parse_actions = ts_parse_actions, - .symbol_names = ts_symbol_names, - .symbol_metadata = ts_symbol_metadata, - .public_symbol_map = ts_symbol_map, - .alias_map = ts_non_terminal_alias_map, - .alias_sequences = &ts_alias_sequences[0][0], - .lex_modes = ts_lex_modes, - .lex_fn = ts_lex, - .primary_state_ids = ts_primary_state_ids, - }; - return &language; -} + extern const TSLanguage * + tree_sitter_yts (void) + { + static const TSLanguage language = { + .version = LANGUAGE_VERSION, + .symbol_count = SYMBOL_COUNT, + .alias_count = ALIAS_COUNT, + .token_count = TOKEN_COUNT, + .external_token_count = EXTERNAL_TOKEN_COUNT, + .state_count = STATE_COUNT, + .large_state_count = LARGE_STATE_COUNT, + .production_id_count = PRODUCTION_ID_COUNT, + .field_count = FIELD_COUNT, + .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, + .parse_table = &ts_parse_table[0][0], + .small_parse_table = ts_small_parse_table, + .small_parse_table_map = ts_small_parse_table_map, + .parse_actions = ts_parse_actions, + .symbol_names = ts_symbol_names, + .symbol_metadata = ts_symbol_metadata, + .public_symbol_map = ts_symbol_map, + .alias_map = ts_non_terminal_alias_map, + .alias_sequences = &ts_alias_sequences[0][0], + .lex_modes = ts_lex_modes, + .lex_fn = ts_lex, + .primary_state_ids = ts_primary_state_ids, + }; + return &language; + } #ifdef __cplusplus } #endif diff --git a/sys/nixpkgs/pkgs/tree-sitter-yts/src/tree_sitter/parser.h b/sys/nixpkgs/pkgs/tree-sitter-yts/src/tree_sitter/parser.h index 2b14ac10..972913cf 100644 --- a/sys/nixpkgs/pkgs/tree-sitter-yts/src/tree_sitter/parser.h +++ b/sys/nixpkgs/pkgs/tree-sitter-yts/src/tree_sitter/parser.h @@ -2,7 +2,8 @@ #define TREE_SITTER_PARSER_H_ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif #include <stdbool.h> @@ -13,158 +14,171 @@ extern "C" { #define ts_builtin_sym_end 0 #define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 -typedef uint16_t TSStateId; + typedef uint16_t TSStateId; #ifndef TREE_SITTER_API_H_ -typedef uint16_t TSSymbol; -typedef uint16_t TSFieldId; -typedef struct TSLanguage TSLanguage; + typedef uint16_t TSSymbol; + typedef uint16_t TSFieldId; + typedef struct TSLanguage TSLanguage; #endif -typedef struct { - TSFieldId field_id; - uint8_t child_index; - bool inherited; -} TSFieldMapEntry; - -typedef struct { - uint16_t index; - uint16_t length; -} TSFieldMapSlice; - -typedef struct { - bool visible; - bool named; - bool supertype; -} TSSymbolMetadata; - -typedef struct TSLexer TSLexer; - -struct TSLexer { - int32_t lookahead; - TSSymbol result_symbol; - void (*advance)(TSLexer *, bool); - void (*mark_end)(TSLexer *); - uint32_t (*get_column)(TSLexer *); - bool (*is_at_included_range_start)(const TSLexer *); - bool (*eof)(const TSLexer *); -}; - -typedef enum { - TSParseActionTypeShift, - TSParseActionTypeReduce, - TSParseActionTypeAccept, - TSParseActionTypeRecover, -} TSParseActionType; - -typedef union { - struct { + typedef struct + { + TSFieldId field_id; + uint8_t child_index; + bool inherited; + } TSFieldMapEntry; + + typedef struct + { + uint16_t index; + uint16_t length; + } TSFieldMapSlice; + + typedef struct + { + bool visible; + bool named; + bool supertype; + } TSSymbolMetadata; + + typedef struct TSLexer TSLexer; + + struct TSLexer + { + int32_t lookahead; + TSSymbol result_symbol; + void (*advance) (TSLexer *, bool); + void (*mark_end) (TSLexer *); + uint32_t (*get_column) (TSLexer *); + bool (*is_at_included_range_start) (const TSLexer *); + bool (*eof) (const TSLexer *); + }; + + typedef enum + { + TSParseActionTypeShift, + TSParseActionTypeReduce, + TSParseActionTypeAccept, + TSParseActionTypeRecover, + } TSParseActionType; + + typedef union + { + struct + { + uint8_t type; + TSStateId state; + bool extra; + bool repetition; + } shift; + struct + { + uint8_t type; + uint8_t child_count; + TSSymbol symbol; + int16_t dynamic_precedence; + uint16_t production_id; + } reduce; uint8_t type; - TSStateId state; - bool extra; - bool repetition; - } shift; - struct { - uint8_t type; - uint8_t child_count; - TSSymbol symbol; - int16_t dynamic_precedence; - uint16_t production_id; - } reduce; - uint8_t type; -} TSParseAction; - -typedef struct { - uint16_t lex_state; - uint16_t external_lex_state; -} TSLexMode; - -typedef union { - TSParseAction action; - struct { - uint8_t count; - bool reusable; - } entry; -} TSParseActionEntry; - -struct TSLanguage { - uint32_t version; - uint32_t symbol_count; - uint32_t alias_count; - uint32_t token_count; - uint32_t external_token_count; - uint32_t state_count; - uint32_t large_state_count; - uint32_t production_id_count; - uint32_t field_count; - uint16_t max_alias_sequence_length; - const uint16_t *parse_table; - const uint16_t *small_parse_table; - const uint32_t *small_parse_table_map; - const TSParseActionEntry *parse_actions; - const char * const *symbol_names; - const char * const *field_names; - const TSFieldMapSlice *field_map_slices; - const TSFieldMapEntry *field_map_entries; - const TSSymbolMetadata *symbol_metadata; - const TSSymbol *public_symbol_map; - const uint16_t *alias_map; - const TSSymbol *alias_sequences; - const TSLexMode *lex_modes; - bool (*lex_fn)(TSLexer *, TSStateId); - bool (*keyword_lex_fn)(TSLexer *, TSStateId); - TSSymbol keyword_capture_token; - struct { - const bool *states; - const TSSymbol *symbol_map; - void *(*create)(void); - void (*destroy)(void *); - bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); - unsigned (*serialize)(void *, char *); - void (*deserialize)(void *, const char *, unsigned); - } external_scanner; - const TSStateId *primary_state_ids; -}; - -/* - * Lexer Macros - */ - -#define START_LEXER() \ - bool result = false; \ - bool skip = false; \ - bool eof = false; \ - int32_t lookahead; \ - goto start; \ - next_state: \ - lexer->advance(lexer, skip); \ - start: \ - skip = false; \ + } TSParseAction; + + typedef struct + { + uint16_t lex_state; + uint16_t external_lex_state; + } TSLexMode; + + typedef union + { + TSParseAction action; + struct + { + uint8_t count; + bool reusable; + } entry; + } TSParseActionEntry; + + struct TSLanguage + { + uint32_t version; + uint32_t symbol_count; + uint32_t alias_count; + uint32_t token_count; + uint32_t external_token_count; + uint32_t state_count; + uint32_t large_state_count; + uint32_t production_id_count; + uint32_t field_count; + uint16_t max_alias_sequence_length; + const uint16_t *parse_table; + const uint16_t *small_parse_table; + const uint32_t *small_parse_table_map; + const TSParseActionEntry *parse_actions; + const char *const *symbol_names; + const char *const *field_names; + const TSFieldMapSlice *field_map_slices; + const TSFieldMapEntry *field_map_entries; + const TSSymbolMetadata *symbol_metadata; + const TSSymbol *public_symbol_map; + const uint16_t *alias_map; + const TSSymbol *alias_sequences; + const TSLexMode *lex_modes; + bool (*lex_fn) (TSLexer *, TSStateId); + bool (*keyword_lex_fn) (TSLexer *, TSStateId); + TSSymbol keyword_capture_token; + struct + { + const bool *states; + const TSSymbol *symbol_map; + void *(*create) (void); + void (*destroy) (void *); + bool (*scan) (void *, TSLexer *, const bool *symbol_whitelist); + unsigned (*serialize) (void *, char *); + void (*deserialize) (void *, const char *, unsigned); + } external_scanner; + const TSStateId *primary_state_ids; + }; + + /* + * Lexer Macros + */ + +#define START_LEXER() \ + bool result = false; \ + bool skip = false; \ + bool eof = false; \ + int32_t lookahead; \ + goto start; \ + next_state: \ + lexer->advance (lexer, skip); \ + start: \ + skip = false; \ lookahead = lexer->lookahead; -#define ADVANCE(state_value) \ - { \ - state = state_value; \ - goto next_state; \ +#define ADVANCE(state_value) \ + { \ + state = state_value; \ + goto next_state; \ } -#define SKIP(state_value) \ - { \ - skip = true; \ - state = state_value; \ - goto next_state; \ +#define SKIP(state_value) \ + { \ + skip = true; \ + state = state_value; \ + goto next_state; \ } -#define ACCEPT_TOKEN(symbol_value) \ - result = true; \ - lexer->result_symbol = symbol_value; \ - lexer->mark_end(lexer); +#define ACCEPT_TOKEN(symbol_value) \ + result = true; \ + lexer->result_symbol = symbol_value; \ + lexer->mark_end (lexer); #define END_STATE() return result; -/* - * Parse Table Macros - */ + /* + * Parse Table Macros + */ #define SMALL_STATE(id) id - LARGE_STATE_COUNT @@ -172,53 +186,56 @@ struct TSLanguage { #define ACTIONS(id) id -#define SHIFT(state_value) \ - {{ \ - .shift = { \ - .type = TSParseActionTypeShift, \ - .state = state_value \ - } \ - }} - -#define SHIFT_REPEAT(state_value) \ - {{ \ - .shift = { \ - .type = TSParseActionTypeShift, \ - .state = state_value, \ - .repetition = true \ - } \ - }} - -#define SHIFT_EXTRA() \ - {{ \ - .shift = { \ - .type = TSParseActionTypeShift, \ - .extra = true \ - } \ - }} - -#define REDUCE(symbol_val, child_count_val, ...) \ - {{ \ - .reduce = { \ - .type = TSParseActionTypeReduce, \ - .symbol = symbol_val, \ - .child_count = child_count_val, \ - __VA_ARGS__ \ - }, \ - }} - -#define RECOVER() \ - {{ \ - .type = TSParseActionTypeRecover \ - }} - -#define ACCEPT_INPUT() \ - {{ \ - .type = TSParseActionTypeAccept \ - }} +#define SHIFT(state_value) \ + { \ + { \ + .shift = {.type = TSParseActionTypeShift, .state = state_value } \ + } \ + } + +#define SHIFT_REPEAT(state_value) \ + { \ + { \ + .shift \ + = {.type = TSParseActionTypeShift, \ + .state = state_value, \ + .repetition = true } \ + } \ + } + +#define SHIFT_EXTRA() \ + { \ + { \ + .shift = {.type = TSParseActionTypeShift, .extra = true } \ + } \ + } + +#define REDUCE(symbol_val, child_count_val, ...) \ + { \ + { \ + .reduce = { .type = TSParseActionTypeReduce, \ + .symbol = symbol_val, \ + .child_count = child_count_val, \ + __VA_ARGS__ }, \ + } \ + } + +#define RECOVER() \ + { \ + { \ + .type = TSParseActionTypeRecover \ + } \ + } + +#define ACCEPT_INPUT() \ + { \ + { \ + .type = TSParseActionTypeAccept \ + } \ + } #ifdef __cplusplus } #endif -#endif // TREE_SITTER_PARSER_H_ +#endif // TREE_SITTER_PARSER_H_ diff --git a/sys/nixpkgs/pkgs/tree-sitter-yts/treefmt.toml b/sys/nixpkgs/pkgs/tree-sitter-yts/treefmt.toml index e84ae516..3d604b40 100644 --- a/sys/nixpkgs/pkgs/tree-sitter-yts/treefmt.toml +++ b/sys/nixpkgs/pkgs/tree-sitter-yts/treefmt.toml @@ -7,15 +7,15 @@ excludes = ["test/**.nix"] command = "prettier" options = ["--write"] includes = [ - "*.css", - "*.html", - "*.js", - "*.json", - "*.jsx", - "*.md", - "*.mdx", - "*.scss", - "*.ts", + "*.css", + "*.html", + "*.js", + "*.json", + "*.jsx", + "*.md", + "*.mdx", + "*.scss", + "*.ts", ] excludes = ["src/**.json"] @@ -26,8 +26,8 @@ includes = ["*.rs"] [formatter.c] command = "clang-format" -options = [ "-i" ] -includes = [ "*.c", "*.cpp", "*.cc", "*.h", "*.hpp" ] +options = ["-i"] +includes = ["*.c", "*.cpp", "*.cc", "*.h", "*.hpp"] excludes = [ "bindings/node/binding.cc", "src/parser.c", diff --git a/sys/nixpkgs/pkgs/update_pkgs.sh b/sys/nixpkgs/pkgs/update_pkgs.sh index 8392fb1c..be1573c6 100755 --- a/sys/nixpkgs/pkgs/update_pkgs.sh +++ b/sys/nixpkgs/pkgs/update_pkgs.sh @@ -1,18 +1,17 @@ #!/usr/bin/env sh die() { - printf "\033[31;1mError: \033[0m%s" "$1"; + printf "\033[31;1mError: \033[0m%s" "$1" exit 1 } cd "$(dirname "$0")" || die "Bug: run with false dirname ('$0')!" - fd . --type directory --max-depth 1 | while read -r dir; do cd "$dir" || die "Dir '$dir' does not exist" if [ -f update.sh ]; then - printf "\033[34;1m> \033[0m\033[34;1m%s\033[0m\n" "Running '${dir}update.sh'"; + printf "\033[34;1m> \033[0m\033[34;1m%s\033[0m\n" "Running '${dir}update.sh'" [ -f flake.nix ] && nix flake update @@ -20,8 +19,7 @@ fd . --type directory --max-depth 1 | while read -r dir; do eval "$(direnv export bash 2>/dev/null)" ./update.sh "$@" fi - cd - > /dev/null || die "Bug: Last dir does not exist" + cd - >/dev/null || die "Bug: Last dir does not exist" done - # vim: ft=sh diff --git a/sys/nixpkgs/pkgs/update_vim_plugins/check-duplicates.sh b/sys/nixpkgs/pkgs/update_vim_plugins/check-duplicates.sh index dcf8b46f..781b8aeb 100755 --- a/sys/nixpkgs/pkgs/update_vim_plugins/check-duplicates.sh +++ b/sys/nixpkgs/pkgs/update_vim_plugins/check-duplicates.sh @@ -5,12 +5,10 @@ count=$(echo "$plugins" | uniq -d | wc -l) echo "duplicates count: $count" -if [ "$count" -gt 0 ] -then +if [ "$count" -gt 0 ]; then filtered_plugins=$(echo "$plugins" | uniq -d) - if [ "$1" == "check-only" ] - then + if [ "$1" == "check-only" ]; then echo "$filtered_plugins" exit 1 else @@ -21,22 +19,18 @@ then # iterate over plugins we found missing and # compare them to all open issues. # We no matching issue was found, we create a new one - for f in $filtered_plugins # do not add " " here. It would break the plugin - do + for f in $filtered_plugins; do # do not add " " here. It would break the plugin found=false - for k in $known_issues - do - if [[ "$f" == "$k" ]] - then + for k in $known_issues; do + if [[ $f == "$k" ]]; then found=true break fi done # test if matching issue was found - if ! $found - then + if ! $found; then echo "Did not find an issue for $f. Creating a new one ..." gh issue create --title "Detected broken plugin: $f" --label "bot" --body "$f" else diff --git a/sys/nixpkgs/pkgs/update_vim_plugins/pyproject.toml b/sys/nixpkgs/pkgs/update_vim_plugins/pyproject.toml index d73a63f8..38caf76d 100644 --- a/sys/nixpkgs/pkgs/update_vim_plugins/pyproject.toml +++ b/sys/nixpkgs/pkgs/update_vim_plugins/pyproject.toml @@ -3,7 +3,7 @@ name = "update_vim_plugins" version = "0.1.0" description = "" authors = ["Your Name <you@example.com>"] -packages = [{include = "update_vim_plugins"}] +packages = [{ include = "update_vim_plugins" }] [tool.poetry.scripts] update-vim-plugins = "update_vim_plugins.__main__:main" diff --git a/sys/nixpkgs/pkgs/update_vim_plugins/update_vim_plugins/spec.py b/sys/nixpkgs/pkgs/update_vim_plugins/update_vim_plugins/spec.py index 04f25ccc..edbd876b 100644 --- a/sys/nixpkgs/pkgs/update_vim_plugins/update_vim_plugins/spec.py +++ b/sys/nixpkgs/pkgs/update_vim_plugins/update_vim_plugins/spec.py @@ -35,7 +35,7 @@ class PluginSpec: branch_regex = r"(:(?P<branch>[^:]+)?)" name_regex = r"(:(?P<name>[^:]+)?)" license_regex = r"(:(?P<license>[^:]+)?)" - marked_duplicate_regex = r'(:(?P<duplicate>duplicate))' + marked_duplicate_regex = r"(:(?P<duplicate>duplicate))" spec_regex = re.compile( f"^{repository_host_regex}?{owner_regex}/{repo_regex}{branch_regex}?{name_regex}?{license_regex}?{marked_duplicate_regex}?$", @@ -60,7 +60,7 @@ class PluginSpec: branch = group_dict.get("branch") name = group_dict.get("name") license = group_dict.get("license") - marked_duplicate = bool(group_dict.get("duplicate")) # True if 'duplicate', False if None + marked_duplicate = bool(group_dict.get("duplicate")) # True if 'duplicate', False if None line = spec diff --git a/sys/nixpkgs/pkgs/yt/update.sh b/sys/nixpkgs/pkgs/yt/update.sh index 2e59aa60..c678b421 100755 --- a/sys/nixpkgs/pkgs/yt/update.sh +++ b/sys/nixpkgs/pkgs/yt/update.sh @@ -3,5 +3,4 @@ cargo update [ "$1" = "upgrade" ] && cargo upgrade - # vim: ft=sh diff --git a/sys/svcs/xdg/scripts/lf_wrapper.sh b/sys/svcs/xdg/scripts/lf_wrapper.sh index 7a508d39..d3aa3e30 100755 --- a/sys/svcs/xdg/scripts/lf_wrapper.sh +++ b/sys/svcs/xdg/scripts/lf_wrapper.sh @@ -37,7 +37,7 @@ termcmd="${TERMINAL:-$(command -v alacritty)}" if [ "$save" = "1" ]; then set -- -selection-path="$out" -command='set promptfmt "Select the file to write to %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' "$recommended_path" - cat << EOF > "$recommended_path" + cat <<EOF >"$recommended_path" xdg-desktop-portal-termfilechooser saving files tutorial !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/sys/svcs/xdg/scripts/ranger-wrapper.sh b/sys/svcs/xdg/scripts/ranger-wrapper.sh index a98cff32..46d8e045 100755 --- a/sys/svcs/xdg/scripts/ranger-wrapper.sh +++ b/sys/svcs/xdg/scripts/ranger-wrapper.sh @@ -50,7 +50,7 @@ Notes: that, for example. 2) If you quit ranger without opening a file, this file will be removed and the save operation aborted. -' > "$path" +' >"$path" elif [ "$directory" = "1" ]; then set -- --choosedir="$out" --show-only-dirs --cmd="echo Select directory (quit in dir to select it)" elif [ "$multiple" = "1" ]; then @@ -59,7 +59,7 @@ else set -- --choosefile="$out" --cmd="echo Select file (open file to select it)" fi -"$termcmd" -- $cmd "$@" +"$termcmd" -- "$cmd" "$@" if [ "$save" = "1" ] && [ ! -s "$out" ]; then rm "$path" fi diff --git a/todo.md b/todo.md index 687b580c..71763756 100644 --- a/todo.md +++ b/todo.md @@ -1,45 +1,46 @@ # Things to do -- [x] QEMU -- [ ] Tex - - [ ] Rework the luasnip snippets -- [x] direnv -- [ ] look at [this](https://github.com/EdenEast/nyx) -- [ ] git-bug - - [ ] Integrate git-bug into gitea -- [ ] Transfer the last user configs - - [x] secret token for nheko - - [x] Set up gpg - - [ ] subkey for onlykey -> Does not work, would require a real smartcard - - [x] Set up the last of the scripts - - [x] tridactly for firefox - - [ ] native messaging for video-pause -- [ ] Go through the system configs -- [x] Go through the packages -- [x] Swap & Zram -- [ ] grep for TODO: -- [ ] Go through `journalctl -p warning -b` -- [x] Encrypted Storage -- [x] Optimize the imports with `*.follows = *` -- [x] Backups -- [ ] Fixes - - [ ] Printer using raw que, maybe because of state - - [ ] Use correct drivers for printer instead of raw - - [x] keybindings for less - - [x] Make gsettings work - - [x] correct order for firefox user.js - - [ ] Update hosts config - - [x] Hibernate in Swap - - [x] Default cursor theme (not only in gtk) - - [ ] Set Default volume -> xdg-desktop-portal - - [x] mpd server - - [ ] rt for audio - - [ ] disable systemd services, which already have a timer - - [x] activate ltex-ls for gitcommit message -- needs testing - - [ ] grub background image - - [ ] remove nixos-presistend subvol - - [ ] Get flake_update into nixpkgs, and add it to direnv - - [ ] Networking for vms - - [ ] https://stackoverflow.com/a/58550269 -- [ ] River - - [ ] Change the bar to sth else - - [x] Set a wallpaper in swaylock + +- \[x\] QEMU +- \[ \] Tex + - \[ \] Rework the luasnip snippets +- \[x\] direnv +- \[ \] look at [this](https://github.com/EdenEast/nyx) +- \[ \] git-bug + - \[ \] Integrate git-bug into gitea +- \[ \] Transfer the last user configs + - \[x\] secret token for nheko + - \[x\] Set up gpg + - \[ \] subkey for onlykey -> Does not work, would require a real smartcard + - \[x\] Set up the last of the scripts + - \[x\] tridactly for firefox + - \[ \] native messaging for video-pause +- \[ \] Go through the system configs +- \[x\] Go through the packages +- \[x\] Swap & Zram +- \[ \] grep for TODO: +- \[ \] Go through `journalctl -p warning -b` +- \[x\] Encrypted Storage +- \[x\] Optimize the imports with `*.follows = *` +- \[x\] Backups +- \[ \] Fixes + - \[ \] Printer using raw que, maybe because of state + - \[ \] Use correct drivers for printer instead of raw + - \[x\] keybindings for less + - \[x\] Make gsettings work + - \[x\] correct order for firefox user.js + - \[ \] Update hosts config + - \[x\] Hibernate in Swap + - \[x\] Default cursor theme (not only in gtk) + - \[ \] Set Default volume -> xdg-desktop-portal + - \[x\] mpd server + - \[ \] rt for audio + - \[ \] disable systemd services, which already have a timer + - \[x\] activate ltex-ls for gitcommit message -- needs testing + - \[ \] grub background image + - \[ \] remove nixos-presistend subvol + - \[ \] Get flake_update into nixpkgs, and add it to direnv + - \[ \] Networking for vms + - \[ \] https://stackoverflow.com/a/58550269 +- \[ \] River + - \[ \] Change the bar to sth else + - \[x\] Set a wallpaper in swaylock |