2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-01 15:06:06 +00:00

Improve tab completion of fetch

This commit is contained in:
Jarrod Johnson
2026-08-13 16:23:09 -04:00
parent 2660842b9a
commit f7815bd7cf
3 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ _confluent_osimage_completion()
return
elif [ ${CMPARGS[1]} == 'fetch' ]; then
if [ $NUMARGS == 3 ]; then
COMPREPLY=($(compgen -W "alma-10-aarch64 alma-10-x86_64 debian-13-amd64 rocky-10-aarch64 rocky-10-x86_64 ubuntu-26.04-amd64 ubuntu-26.04-arm64 " -- ${COMP_WORDS[COMP_CWORD]}))
COMPREPLY=($(compgen -W "$(osdeploy getfetchable)" -- "${COMP_WORDS[COMP_CWORD]}"))
return
fi
compopt -o dirnames
+4
View File
@@ -66,6 +66,10 @@ async def main(args):
osls = sp.add_parser('list', help='List OS images available for deployment')
ubp = sp.add_parser('rebase', help='Update stock profile content from packaged updates')
ubp.add_argument('profile', help='Profile to rebase from packaged content')
if len(sys.argv) > 2 and sys.argv[1] == 'getfetchable': # for bash completion
distlist = download.list_fetchable_distributions()
print (' '.join(distlist))
sys.exit(0)
cmdset = ap.parse_args()
if cmdset.command == 'list':
@@ -93,6 +93,21 @@ REQUEST_TIMEOUT = aiohttp.ClientTimeout(total=30)
DOWNLOAD_TIMEOUT = aiohttp.ClientTimeout(total=None, sock_connect=30, sock_read=60)
def list_fetchable_distributions():
"""Return a list of all known fetchable distributions."""
distlist = []
for name, cfg in EL_DISTROS.items():
for arch in SUPPORTED_ARCHS:
for major in (8, 9, 10):
distlist.append(f"{name}-{major}-{arch}")
for ver in UBUNTU["sources"]:
for version in ["24.04", "26.04"]:
distlist.append(f"ubuntu-{version}-{ver[0]}")
for codename, ver in DEBIAN["suites"]:
for arch in DEBIAN["arches"]:
distlist.append(f"debian-{ver}-{arch}")
return distlist
# Many of the OS download sites are auto generated HTML indexes, we must parse them
class DirectoryParser(HTMLParser):
"""Extract href links from an nginx/apache directory listing page."""