Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • willsalmon/buildstream
  • CumHoleZH/buildstream
  • tchaik/buildstream
  • DCotyPortfolio/buildstream
  • jesusoctavioas/buildstream
  • patrickmmartin/buildstream
  • franred/buildstream
  • tintou/buildstream
  • alatiera/buildstream
  • martinblanchard/buildstream
  • neverdie22042524/buildstream
  • Mattlk13/buildstream
  • PServers/buildstream
  • phamnghia610909/buildstream
  • chiaratolentino/buildstream
  • eysz7-x-x/buildstream
  • kerrick1/buildstream
  • matthew-yates/buildstream
  • twofeathers/buildstream
  • mhadjimichael/buildstream
  • pointswaves/buildstream
  • Mr.JackWilson/buildstream
  • Tw3akG33k/buildstream
  • AlexFazakas/buildstream
  • eruidfkiy/buildstream
  • clamotion2/buildstream
  • nanonyme/buildstream
  • wickyjaaa/buildstream
  • nmanchev/buildstream
  • bojorquez.ja/buildstream
  • mostynb/buildstream
  • highpit74/buildstream
  • Demo112/buildstream
  • ba2014sheer/buildstream
  • tonimadrino/buildstream
  • usuario2o/buildstream
  • Angelika123456/buildstream
  • neo355/buildstream
  • corentin-ferlay/buildstream
  • coldtom/buildstream
  • wifitvbox81/buildstream
  • 358253885/buildstream
  • seanborg/buildstream
  • SotK/buildstream
  • DouglasWinship/buildstream
  • karansthr97/buildstream
  • louib/buildstream
  • bwh-ct/buildstream
  • robjh/buildstream
  • we88c0de/buildstream
  • zhengxian5555/buildstream
51 results
Select Git revision
Show changes
Commits on Source (2)
......@@ -161,7 +161,7 @@ def override_main(self, args=None, prog_name=None, complete_var=None,
# Hook for the Bash completion. This only activates if the Bash
# completion is actually enabled, otherwise this is quite a fast
# noop.
if main_bashcomplete(self, prog_name, override_completions):
if main_bashcomplete(self, prog_name, args, override_completions):
# If we're running tests we cant just go calling exit()
# from the main process.
......
......@@ -313,10 +313,10 @@ def get_choices(cli, prog_name, args, incomplete, override):
yield item
def do_complete(cli, prog_name, override):
def do_complete(cli, prog_name, args, override):
cwords = split_arg_string(os.environ['COMP_WORDS'])
cword = int(os.environ['COMP_CWORD'])
args = cwords[1:cword]
args = args + cwords[1:cword]
try:
incomplete = cwords[cword]
except IndexError:
......@@ -328,11 +328,11 @@ def do_complete(cli, prog_name, override):
# Main function called from main.py at startup here
#
def main_bashcomplete(cmd, prog_name, override):
def main_bashcomplete(cmd, prog_name, args, override):
"""Internal handler for the bash completion support."""
if '_BST_COMPLETION' in os.environ:
do_complete(cmd, prog_name, override)
do_complete(cmd, prog_name, args, override)
return True
return False
......@@ -281,3 +281,44 @@ def test_argument_element_invalid(datafiles, cli, project, cmd, word_idx, expect
])
def test_help_commands(cli, cmd, word_idx, expected):
assert_completion(cli, cmd, word_idx, expected)
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'project'))
def test_argument_artifact(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
# Build an import element with no dependencies (as there will only be ONE cache key)
result = cli.run(project=project, args=['build', 'import-bin.bst']) # Has no dependencies
result.assert_success()
# Get the key and the artifact ref ($project/$element_name/$key)
key = cli.get_element_key(project, 'import-bin.bst')
artifact = os.path.join('test', 'import-bin', key)
# Test autocompletion of the artifact
cmds = [
'bst artifact log ',
'bst artifact log t',
'bst artifact log test/'
]
for i, cmd in enumerate(cmds):
word_idx = 3
result = cli.run(project=project, cwd=project, env={
'_BST_COMPLETION': 'complete',
'COMP_WORDS': cmd,
'COMP_CWORD': str(word_idx)
})
words = []
if result.output:
words = result.output.splitlines() # This leaves an extra space on each e.g. 'foo.bst ']
words = [word.strip() for word in words]
if i == 0:
expected = PROJECT_ELEMENTS + [artifact] # We should now be able to see the artifact
elif i == 1:
expected = ['target.bst', artifact]
elif i == 2:
expected = [artifact]
assert expected == words