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