Various scripts that I maintain
utils scripts
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

update-gitignore: new script

+59
+3
.gitmodules
··· 1 + [submodule "resources/gitignore"] 2 + path = resources/gitignore 3 + url = https://github.com/github/gitignore
+3
README.md
··· 20 20 21 21 See `--help` for usage. 22 22 23 + ## update-gitignore 24 + Quickly and easily create or update `gitignore` files from predefined templates. 25 + 23 26 ## adb-auto-connect 24 27 Automatically find and connect to an Android device with Wireless Debugging over the local network. 25 28
+53
scripts/update-gitignore.nu
··· 1 + #!/usr/bin/env nu 2 + # SPDX-License-Identifier: AGPL-3.0-only 3 + # Copyright (c) 2026 MatrixFurry <matrix@matrixfurry.com> 4 + 5 + const self = path self | path expand 6 + const templates_dir = $self | path join ../../resources/gitignore/ 7 + 8 + # Create a gitignore file from predefined templates 9 + def main [ 10 + --replace (-r) # Overwrite the exiting gitignore rather than appending to it 11 + --global (-g) # Create a global ignore file at `~/.config/git/ignore` 12 + ] { 13 + let output_path: path = if $global { 14 + mkdir ~/.config/git 15 + "~/.config/git/ignore" | path expand 16 + } else { 17 + pwd | path join .gitignore 18 + } 19 + 20 + let op = if ($output_path | path exists) { 21 + if $replace {$"(ansi red)Replaced"} else {$"(ansi yellow)Appended(ansi reset) to"} 22 + } else { 23 + $"(ansi green)Created" 24 + } 25 + 26 + # TODO: add global to display name or color code 27 + let templates = ls -f $templates_dir 28 + | append (ls -f ($templates_dir + "/Global")) 29 + | where type == file 30 + | get name 31 + 32 + let selected_templates = $templates 33 + | input list -mf -s 'smart' -d {|| path parse | get stem} $"Use (ansi blue)<Tab>(ansi reset) to select templates, then (ansi blue)<Return>(ansi reset) to create" 34 + 35 + $selected_templates 36 + | each {|path| 37 + let name = $path | path parse | get stem 38 + 39 + $"### ($name) template\n(open --raw $path)" 40 + } 41 + | str join "\n" 42 + | if $replace { 43 + save -f $output_path 44 + } else { 45 + save -a $output_path 46 + } 47 + 48 + print $"($op)(ansi reset) gitignore at (ansi blue)($output_path)(ansi reset) with the following templates:" 49 + $selected_templates 50 + | each {|| $"- (ansi cyan)($in | path parse | get stem)(ansi reset)"} 51 + | str join "\n" 52 + | print 53 + }