mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Add list argument to quickget. Close #97
For UI creators, `quickget list` will print to strdout asll the support operating systems and releases.
This commit is contained in:
		
							parent
							
								
									abd5e99c47
								
							
						
					
					
						commit
						b7493cee10
					
				
					 1 changed files with 89 additions and 45 deletions
				
			
		
							
								
								
									
										134
									
								
								quickget
									
										
									
									
									
								
							
							
						
						
									
										134
									
								
								quickget
									
										
									
									
									
								
							|  | @ -1,8 +1,45 @@ | ||||||
| #!/usr/bin/env bash | #!/usr/bin/env bash | ||||||
| 
 | 
 | ||||||
|  | function list_all() { | ||||||
|  |   local DISPLAY_NAME | ||||||
|  |   local FUNC | ||||||
|  |   local LANG | ||||||
|  |   local OS | ||||||
|  |   local RELEASE | ||||||
|  |   echo "Display Name,OS,Release,Language" | ||||||
|  |   for OS in $(os_support); do | ||||||
|  |     if [[ "${OS}" == *"ubuntu"* ]]; then | ||||||
|  |       FUNC="ubuntu" | ||||||
|  |     else | ||||||
|  |       FUNC="${OS}" | ||||||
|  |     fi | ||||||
|  |     case ${OS} in | ||||||
|  |       freebsd) DISPLAY_NAME="FreeBSD";; | ||||||
|  |       linuxmint) DISPLAY_NAME="Linux Mint";; | ||||||
|  |       macos) DISPLAY_NAME="macOS";; | ||||||
|  |       opensuse) DISPLAY_NAME="OpenSUSE";; | ||||||
|  |       ubuntu-budgie) DISPLAY_NAME="Ubuntu Budgie";; | ||||||
|  |       ubuntu-kylin) DISPLAY_NAME="Ubuntu Kylin";; | ||||||
|  |       ubuntu-mate) DISPLAY_NAME="Ubuntu MATE";; | ||||||
|  |       ubuntu-studio) DISPLAY_NAME="Ubuntu Studio";; | ||||||
|  |       *) DISPLAY_NAME="${OS^}";; | ||||||
|  |     esac | ||||||
|  |     for RELEASE in $("releases_${FUNC}"); do | ||||||
|  |       if [ "${OS}" == "windows" ]; then | ||||||
|  |         for LANG in "${LANGS[@]}"; do | ||||||
|  |           echo "${DISPLAY_NAME},${OS},${RELEASE},${LANG}", | ||||||
|  |         done | ||||||
|  |       else | ||||||
|  |         echo "${DISPLAY_NAME},${OS},${RELEASE},," | ||||||
|  |       fi | ||||||
|  |     done | ||||||
|  |   done | ||||||
|  |   exit 0 | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function os_support() { | function os_support() { | ||||||
|     echo freebsd \ |     echo fedora \ | ||||||
|     fedora \ |     freebsd \ | ||||||
|     kubuntu \ |     kubuntu \ | ||||||
|     linuxmint \ |     linuxmint \ | ||||||
|     lubuntu \ |     lubuntu \ | ||||||
|  | @ -39,8 +76,8 @@ function releases_opensuse(){ | ||||||
|     15_1 \ |     15_1 \ | ||||||
|     15_2 \ |     15_2 \ | ||||||
|     15_3 \ |     15_3 \ | ||||||
|     tumbleweed \ |     microos \ | ||||||
|     microos |     tumbleweed | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function releases_macos() { | function releases_macos() { | ||||||
|  | @ -59,44 +96,44 @@ function releases_ubuntu() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function languages_windows() { | function languages_windows() { | ||||||
|     echo Arabic \ |     LANGS=(Arabic | ||||||
|     Brazilian Portuguese \ |     "Brazilian Portuguese" | ||||||
|     Bulgarian \ |     Bulgarian | ||||||
|     Chinese \(Simplified\) \ |     "Chinese (Simplified)" | ||||||
|     Chinese \(Traditional\) \ |     "Chinese (Traditional)" | ||||||
|     Croatian \ |     Croatian | ||||||
|     Czech \ |     Czech | ||||||
|     Danish \ |     Danish | ||||||
|     Dutch \ |     Dutch | ||||||
|     English \ |     English | ||||||
|     English International \ |     "English International" | ||||||
|     Estonian \ |     Estonian | ||||||
|     Finnish \ |     Finnish | ||||||
|     French \ |     French | ||||||
|     French Canadian \ |     "French Canadian" | ||||||
|     German \ |     German | ||||||
|     Greek \ |     Greek | ||||||
|     Hebrew \ |     Hebrew | ||||||
|     Hungarian \ |     Hungarian | ||||||
|     Italian \ |     Italian | ||||||
|     Japanese \ |     Japanese | ||||||
|     Korean \ |     Korean | ||||||
|     Latvian \ |     Latvian | ||||||
|     Lithuanian \ |     Lithuanian | ||||||
|     Norwegian \ |     Norwegian | ||||||
|     Polish \ |     Polish | ||||||
|     Portuguese \ |     Portuguese | ||||||
|     Romanian \ |     Romanian | ||||||
|     Russian \ |     Russian | ||||||
|     Serbian Latin \ |     "Serbian Latin" | ||||||
|     Slovak \ |     Slovak | ||||||
|     Slovenian \ |     Slovenian | ||||||
|     Spanish \ |     Spanish | ||||||
|     Spanish \(Mexico\) \ |     "Spanish (Mexico)" | ||||||
|     Swedish \ |     Swedish | ||||||
|     Thai \ |     Thai | ||||||
|     Turkish \ |     Turkish | ||||||
|     Ukrainian |     Ukrainian) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -748,8 +785,14 @@ function get_windows() { | ||||||
|     start_vm_info |     start_vm_info | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | LANGS=() | ||||||
|  | languages_windows | ||||||
|  | 
 | ||||||
| if [ -n "${1}" ]; then | if [ -n "${1}" ]; then | ||||||
|     OS="${1,,}" |     OS="${1,,}" | ||||||
|  |     if [ "${OS}" == "list" ]; then | ||||||
|  |         list_all | ||||||
|  |     fi | ||||||
| else | else | ||||||
|     echo "ERROR! You must specify an OS:" |     echo "ERROR! You must specify an OS:" | ||||||
|     os_support |     os_support | ||||||
|  | @ -795,10 +838,11 @@ elif [[ "${OS}" == *"ubuntu"* ]]; then | ||||||
| elif [ "${OS}" == "windows" ]; then | elif [ "${OS}" == "windows" ]; then | ||||||
|     if [ -n "${3}" ]; then |     if [ -n "${3}" ]; then | ||||||
|         LANG_NAME="${3}" |         LANG_NAME="${3}" | ||||||
|         LANG_NAMES=$(languages_windows) |         if [[ ! ${LANGS[*]} =~ ${LANG_NAME} ]]; then | ||||||
|         if [[ "${LANG_NAMES}" != *"${LANG_NAME}"* ]]; then |  | ||||||
|             echo "ERROR! ${LANG_NAME} is not a supported language:" |             echo "ERROR! ${LANG_NAME} is not a supported language:" | ||||||
|             languages_windows |             for LANG in "${LANGS[@]}"; do | ||||||
|  |               echo "${LANG}" | ||||||
|  |             done | ||||||
|             exit 1 |             exit 1 | ||||||
|         fi |         fi | ||||||
|     else |     else | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue