Various scripts that I maintain
utils scripts
2
fork

Configure Feed

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

rawrsync: exit with code instead of returning int

+9 -11
+9 -11
scripts/rawrsync.nu
··· 10 10 def main [ 11 11 select?: string # Select a configuration by name 12 12 --continuous (-c) # Sync on file change 13 - ] { 13 + ] { 14 14 if not ($config_path | path exists) { 15 15 log critical $"Could not find configuration file in current directory \(($config_path)\)" 16 - return 1 16 + exit 1 17 17 } 18 - 18 + 19 19 let src: path = pwd | path expand 20 - 20 + 21 21 let config = open $config_path | transpose name data 22 - 22 + 23 23 let dest: record<user, address, path> = if ($config | length) == 1 { 24 24 $config | get 0.data 25 25 } else if ($select | is-not-empty) { 26 26 let selected_entry = $config | where name == $select 27 - 27 + 28 28 if ($selected_entry | length) < 1 { 29 29 log critical $"Could not find selected configuration \"($select)\"" 30 - return 1 30 + exit 1 31 31 } 32 - 32 + 33 33 $selected_entry | get 0.data 34 34 } else { 35 35 $config 36 36 | input list -d name "Sync to..." 37 37 | get data 38 38 } 39 - 39 + 40 40 if $continuous { 41 41 # TODO: only run rsync on changed files 42 42 watch --verbose $src {|| sync $src $dest} ··· 56 56 $"($dest.user)@($dest.address)://($dest.path)" 57 57 ] 58 58 } 59 - 60 -