mirror of
				https://github.com/mitchell/dotfiles.git
				synced 2025-11-04 05:35:26 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			53 lines
		
	
	
		
			1,009 B
		
	
	
	
		
			Fish
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1,009 B
		
	
	
	
		
			Fish
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env -S fish --private
 | 
						|
 | 
						|
set general_help '
 | 
						|
A collection of useful functions for this project.
 | 
						|
 | 
						|
Either run a function like ./swim.fish <function> [arg [arg [...]]
 | 
						|
or source the file and run them as commands:
 | 
						|
$ source ./swim.fish
 | 
						|
$ lint [args]
 | 
						|
 | 
						|
Run ./swim help <function_name> to see it\'s definition.
 | 
						|
'
 | 
						|
 | 
						|
# Configuration
 | 
						|
 | 
						|
set src_fish_files \
 | 
						|
    ./install_arch \
 | 
						|
    ./provision_linux \
 | 
						|
    ./sync \
 | 
						|
    ./upgrade_debian \
 | 
						|
    ./**.fish \
 | 
						|
    ./.**.fish
 | 
						|
 | 
						|
# Commands
 | 
						|
 | 
						|
function lint -d 'Lint fish scripts'
 | 
						|
    fish --no-execute $src_fish_files
 | 
						|
end
 | 
						|
 | 
						|
function format -d 'Format fish scripts'
 | 
						|
    fish_indent --write $src_fish_files
 | 
						|
end
 | 
						|
 | 
						|
# --- execution/help handling ---
 | 
						|
 | 
						|
function help -a function_name -d 'Displays help for internal function'
 | 
						|
    if test -n "$function_name"
 | 
						|
        functions $function_name
 | 
						|
    else
 | 
						|
        echo $general_help
 | 
						|
    end
 | 
						|
end
 | 
						|
 | 
						|
argparse --ignore-unknown h/help -- $argv
 | 
						|
 | 
						|
if test -n "$_flag_h"
 | 
						|
    help $argv
 | 
						|
else if test -n "$argv"
 | 
						|
    $argv
 | 
						|
else
 | 
						|
    echo $general_help
 | 
						|
end
 |