Add autoenv reload subcommand
The `autoenv reload` subcommand reloads the current environment.
This commit is contained in:
		
							parent
							
								
									0b5fc5ad97
								
							
						
					
					
						commit
						c4a91481db
					
				| @ -16,6 +16,7 @@ _autoenv() { | |||||||
|         init:'add .enter and .exit scripts in current directory' |         init:'add .enter and .exit scripts in current directory' | ||||||
|         edit:'edit .enter and .exit scripts in current directory' |         edit:'edit .enter and .exit scripts in current directory' | ||||||
|         deinit:'remove .enter and .exit scripts in current directory' |         deinit:'remove .enter and .exit scripts in current directory' | ||||||
|  |         reload:'reload the current environment' | ||||||
|         add=py:'add Python virtualenv to the autoenv' |         add=py:'add Python virtualenv to the autoenv' | ||||||
|       ) |       ) | ||||||
|       _describe -t commands command commands && ret=0 ;; |       _describe -t commands command commands && ret=0 ;; | ||||||
|  | |||||||
| @ -12,7 +12,7 @@ autoenv() { | |||||||
|   case "$cmd" in |   case "$cmd" in | ||||||
|     -h|--help)  # Display help. |     -h|--help)  # Display help. | ||||||
|       echo "\ |       echo "\ | ||||||
| usage: autoenv [-h] {init,edit,deinit} | usage: autoenv [-h] {init,edit,deinit,reload,add=py} | ||||||
| 
 | 
 | ||||||
| options: | options: | ||||||
|         -h, --help  show this help message and exit |         -h, --help  show this help message and exit | ||||||
| @ -21,6 +21,7 @@ commands: | |||||||
|         init        add .enter and .exit scripts in current directory |         init        add .enter and .exit scripts in current directory | ||||||
|         edit        edit .enter and .exit scripts in current directory |         edit        edit .enter and .exit scripts in current directory | ||||||
|         deinit      remove .enter and .exit scripts in current directory |         deinit      remove .enter and .exit scripts in current directory | ||||||
|  |         reload      reload the current environment | ||||||
|         add=py      add Python virtualenv to the autoenv" |         add=py      add Python virtualenv to the autoenv" | ||||||
|       ;; |       ;; | ||||||
| 
 | 
 | ||||||
| @ -81,6 +82,16 @@ commands: | |||||||
|       done |       done | ||||||
|       ;; |       ;; | ||||||
| 
 | 
 | ||||||
|  |     reload)  # Reload the current environment | ||||||
|  |       if ! [ -f $PWD/.enter ] || ! [ -f $PWD/.exit ]; then | ||||||
|  |         echo '.enter or .exit not found'; return 1 | ||||||
|  |       fi | ||||||
|  |       # Exit the autoenv before editing. | ||||||
|  |       _autoenv_exit $PWD | ||||||
|  |       # Enter the autoenv. | ||||||
|  |       _autoenv_enter $PWD | ||||||
|  |       ;; | ||||||
|  | 
 | ||||||
|     add=py)  # Add Python virtualenv to the sandbox |     add=py)  # Add Python virtualenv to the sandbox | ||||||
|       if ! [ -f $PWD/.enter ] || ! [ -f $PWD/.exit ]; then |       if ! [ -f $PWD/.enter ] || ! [ -f $PWD/.exit ]; then | ||||||
|         echo '.enter or .exit not found'; return 1 |         echo '.enter or .exit not found'; return 1 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user