mirror of
				https://github.com/mitchell/swim.fish.git
				synced 2025-11-03 23:35:25 +00:00 
			
		
		
		
	Update help and do commands
This commit is contained in:
		
							parent
							
								
									f3d8897187
								
							
						
					
					
						commit
						207b02bfef
					
				| 
						 | 
				
			
			@ -40,7 +40,9 @@ function run_swim_command -a prefix
 | 
			
		|||
    else if functions -q $prefix\_default
 | 
			
		||||
        $prefix\_default $args
 | 
			
		||||
    else
 | 
			
		||||
        echo "$prefix command '$command' does not exist"
 | 
			
		||||
        echo "
 | 
			
		||||
$prefix command '$command' does not exist
 | 
			
		||||
Try 'help' command or -h/--help flags"
 | 
			
		||||
        return 127
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -50,11 +52,15 @@ function define_included_functions -a prefix
 | 
			
		|||
 | 
			
		||||
    function $prefix\_do -V prefix -d 'Perform a list of commands separated by commas'
 | 
			
		||||
        for command in (string split ',' "$argv")
 | 
			
		||||
            test -z "$command"; and continue
 | 
			
		||||
            if test -z "$command"
 | 
			
		||||
                continue
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            set -l command (string trim "$command")
 | 
			
		||||
 | 
			
		||||
            echo "Running '$command' ..."
 | 
			
		||||
            run_swim_command $prefix (string split ' ' $command)
 | 
			
		||||
            or return $status
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -85,12 +91,6 @@ function define_included_functions -a prefix
 | 
			
		|||
        end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if not functions -q $prefix\_default
 | 
			
		||||
        function $prefix\_default -a arg -V prefix -d 'Alias for help command'
 | 
			
		||||
            $prefix\_help $arg
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    function $prefix\_is_group -d 'Tells executor whether this is a subcommand group'
 | 
			
		||||
        echo 'is-group'
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								sw
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								sw
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -41,7 +41,9 @@ function run_swim_command -a prefix
 | 
			
		|||
    else if functions -q $prefix\_default
 | 
			
		||||
        $prefix\_default $args
 | 
			
		||||
    else
 | 
			
		||||
        echo "$prefix command '$command' does not exist"
 | 
			
		||||
        echo "
 | 
			
		||||
$prefix command '$command' does not exist
 | 
			
		||||
Try 'help' command or -h/--help flags"
 | 
			
		||||
        return 127
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -51,11 +53,15 @@ function define_included_functions -a prefix
 | 
			
		|||
 | 
			
		||||
    function $prefix\_do -V prefix -d 'Perform a list of commands separated by commas'
 | 
			
		||||
        for command in (string split ',' "$argv")
 | 
			
		||||
            test -z "$command"; and continue
 | 
			
		||||
            if test -z "$command"
 | 
			
		||||
                continue
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            set -l command (string trim "$command")
 | 
			
		||||
 | 
			
		||||
            echo "Running '$command' ..."
 | 
			
		||||
            run_swim_command $prefix (string split ' ' $command)
 | 
			
		||||
            or return $status
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -86,12 +92,6 @@ function define_included_functions -a prefix
 | 
			
		|||
        end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if not functions -q $prefix\_default
 | 
			
		||||
        function $prefix\_default -a arg -V prefix -d 'Alias for help command'
 | 
			
		||||
            $prefix\_help $arg
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    function $prefix\_is_group -d 'Tells executor whether this is a subcommand group'
 | 
			
		||||
        echo 'is-group'
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,11 +44,11 @@ function swim_install -d 'Install the sw script to a bin folder'
 | 
			
		|||
end
 | 
			
		||||
 | 
			
		||||
function swim_lint -d 'Lint fish scripts'
 | 
			
		||||
    fish --no-execute ./sw ./swim.fish
 | 
			
		||||
    fish --no-execute ./sw ./**.fish
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function swim_format -d 'Format fish scripts'
 | 
			
		||||
    fish_indent --write ./sw ./swim.fish
 | 
			
		||||
    fish_indent --write ./sw ./**.fish
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function swim_hello -d 'This is an example of a subgroup of commands'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue