Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_new_command():
assert (get_new_command(Command('git branch list', '')) ==
shell.and_('git branch --delete list', 'git branch'))
def get_new_command(command):
output = command.output.strip()
if is_arg_url(command):
yield command.script.replace('open ', 'open http://')
elif output.startswith('The file ') and output.endswith(' does not exist.'):
arg = command.script.split(' ', 1)[1]
for option in ['touch', 'mkdir']:
yield shell.and_(u'{} {}'.format(option, arg), command.script)
def get_new_command(command):
line = command.output.split('\n')[-3].strip()
branch = line.split(' ')[-1]
set_upstream = line.replace('', 'origin')\
.replace('', branch)
return shell.and_(set_upstream, command.script)
def get_new_command(command):
dir = shell.quote(_tar_file(command.script_parts)[1])
return shell.and_('mkdir -p {dir}', '{cmd} -C {dir}') \
.format(dir=dir, cmd=command.script)
def get_new_command(command):
return shell.and_('git stash', 'git pull', 'git stash pop')
def get_new_command(command):
return shell.and_(
'chmod +x {}'.format(command.script_parts[0][2:]),
command.script)
def get_new_command(command):
path = re.findall(
r"touch: (?:cannot touch ')?(.+)/.+'?:", command.output)[0]
return shell.and_(u'mkdir -p {}'.format(path), command.script)
def get_new_command(command):
cmds = command.script_parts
machine = None
if len(cmds) >= 3:
machine = cmds[2]
start_all_instances = shell.and_(u"vagrant up", command.script)
if machine is None:
return start_all_instances
else:
return [shell.and_(u"vagrant up {}".format(machine), command.script),
start_all_instances]