Test Autocomplete Functionality

I’m looking for information on how to test that a command will autocomplete when a user hits TAB. My Google-fu has failed me.

Example:
In my shell, if I type terminus site: then hit TAB I get:

terminus site:
site:clone                 -- Copy the code, database, and media files from the specified Pantheon source site to the specified Pa
site:create                -- Creates a new site.
site:delete                -- Deletes a site from Pantheon.
site:info                  -- Displays a site's information.
site:list                  -- Displays the list of sites accessible to the currently logged-in user.
site:lookup                -- Displays the UUID of a site given its name.
site:org:add               -- Associates a supporting organization with a site.
site:org:list              -- Displays the list of supporting organizations associated with a site.
site:org:remove            -- Disassociates a supporting organization from a site.
site:team:add              -- Adds a user to a site's team. Note: An invite will be sent if the email is not associated with a Pan
site:team:list             -- Displays the list of team members for a site.
site:team:remove           -- Removes a user from a site's team.
site:team:role             -- Updates a user's role on a site's team.
site:upstream:clear-cache  -- Clears caches for the site's codeserver.
site:upstream:set          -- Changes a site's upstream.

I’d like know if updates break that functionality, but I don’t know where to start. Is this even possible in the non-interactive environment of CircleCI?

Thanks in advance!

1 Like

So I can emulate the keystroke with:

terminus site:$(xdotool key Tab)

But how would I measure the output?

OK, for those following along at home, I answered my own question. In case this helps anyone else in the future, here’s the test script I came up with:

#! /bin/bash
touch completionresults.txt
script -c "terminus site:$(xdotool key Tab)" completionresults.txt

printf "\n\n"

if (grep -q "Did you mean one of these?" "completionresults.txt")
then
  echo "Completion works!"
  exit 0
else
  echo "Completion Failed"
  exit 1
fi
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.