mirror of
				https://github.com/ohmybash/oh-my-bash.git
				synced 2024-05-11 05:55:37 +00:00 
			
		
		
		
	* OMB - Major Refactor - Aliases and completions now works like plugins (need to enabled in .bashrc) - Removed the compatible check in spectrum.sh, OMB now works with Bash v3.x like the old days. - Removed core plugin, added those bash functions into base.sh and load during startup. - Updated OSH template for new installations - Added history config and few other stuff from #17 @TODO: Added a shell script to update old version of .bashrc to new one. * Fixed ShellCheck issues * Fixed ShellCheck issues
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/usr/bin/env bash
 | 
						|
# Completion for gem
 | 
						|
 | 
						|
_installcomp() {
 | 
						|
  if [ -z "$REMOTE_GEMS" ]
 | 
						|
  then
 | 
						|
    REMOTE_GEMS=( $(gem list --remote --no-versions | tr '\n' ' ') )
 | 
						|
  fi
 | 
						|
  
 | 
						|
  local cur=${COMP_WORDS[COMP_CWORD]}
 | 
						|
  COMPREPLY=( $(compgen -W "${REMOTE_GEMS[*]}" -- $cur) )
 | 
						|
}
 | 
						|
 | 
						|
_uninstallcomp() {
 | 
						|
  if [ -z "$LOCAL_GEMS" ]
 | 
						|
  then
 | 
						|
    LOCAL_GEMS=( $(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ') )
 | 
						|
  fi
 | 
						|
  
 | 
						|
  local cur=${COMP_WORDS[COMP_CWORD]}
 | 
						|
  COMPREPLY=( $(compgen -W "${LOCAL_GEMS[*]}" -- $cur) )
 | 
						|
}
 | 
						|
 | 
						|
_gem() {
 | 
						|
  local cur=${COMP_WORDS[COMP_CWORD]}
 | 
						|
  local prev=${COMP_WORDS[COMP_CWORD-1]}
 | 
						|
  case $prev in
 | 
						|
    install)
 | 
						|
      _installcomp
 | 
						|
      return 0
 | 
						|
      ;;
 | 
						|
    uninstall)
 | 
						|
      _uninstallcomp
 | 
						|
      return 0
 | 
						|
      ;;
 | 
						|
  esac
 | 
						|
  local commands=(build cert check cleanup contents dependency environment fetch generate_index help install list lock outdated owner pristine push query rdoc search server sources specification stale uninstall unpack update which)
 | 
						|
  COMPREPLY=( $(compgen -W "${commands[*]}" -- $cur) )
 | 
						|
}
 | 
						|
 | 
						|
complete -F _gem gem
 |