fish: add develop function
This commit is contained in:
		
							parent
							
								
									f1ebe05f1d
								
							
						
					
					
						commit
						68a46a0160
					
				
					 3 changed files with 37 additions and 0 deletions
				
			
		|  | @ -13,6 +13,7 @@ in { | |||
|     ./plugins.nix | ||||
|     ./binds.nix | ||||
|     ./aliases.nix | ||||
|     ./functions | ||||
|   ]; | ||||
| 
 | ||||
|   options.ooknet.home.fish.enable = mkEnableOption ""; | ||||
|  |  | |||
							
								
								
									
										5
									
								
								modules/home/console/shell/fish/functions/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								modules/home/console/shell/fish/functions/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| { | ||||
|   imports = [ | ||||
|     ./develop.nix | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										31
									
								
								modules/home/console/shell/fish/functions/develop.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								modules/home/console/shell/fish/functions/develop.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | |||
| { | ||||
|   self, | ||||
|   pkgs, | ||||
|   ... | ||||
| }: let | ||||
|   # get devshell names from flake | ||||
|   devShellNames = builtins.concatStringsSep " " (builtins.attrNames self.devShells.${pkgs.system}); | ||||
| in { | ||||
|   programs.fish = { | ||||
|     # add devshells completions to init script | ||||
|     interactiveShellInit = '' | ||||
|       complete -c develop -f -a "${devShellNames}" | ||||
|     ''; | ||||
|     functions.develop = { | ||||
|       description = "Easily jump into any of the ooknet devshells"; | ||||
|       body = | ||||
|         #fish | ||||
|         '' | ||||
|           if test -n "$argv[1]" | ||||
|             if test -n "$FLAKE" | ||||
|               nix develop $FLAKE#$argv[1] | ||||
|             else | ||||
|               echo "error: FLAKE variable is not set"; | ||||
|             end | ||||
|           else | ||||
|             echo "error: No argument was provided"; | ||||
|           end | ||||
|         ''; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue