本文整理汇总了Python中thefuck.shells.and_函数的典型用法代码示例。如果您正苦于以下问题:Python and_函数的具体用法?Python and_怎么用?Python and_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了and_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_new_command
def get_new_command(command):
cmds = command.script.split(' ')
machine = None
if len(cmds) >= 3:
machine = cmds[2]
startAllInstances = shells.and_("vagrant up", command.script)
if machine is None:
return startAllInstances
else:
return [ shells.and_("vagrant up " + machine, command.script), startAllInstances]
开发者ID:DJMIN,项目名称:thefuck,代码行数:11,代码来源:vagrant_up.py
示例2: get_new_command
def get_new_command(command, settings):
missing_file = re.findall(
r"error: pathspec '([^']*)' "
"did not match any file\(s\) known to git.", command.stderr)[0]
formatme = shells.and_('git add -- {}', '{}')
return formatme.format(missing_file, command.script)
开发者ID:SanketDG,项目名称:thefuck,代码行数:7,代码来源:git_add.py
示例3: get_new_command
def get_new_command(command, settings):
for pattern in patterns:
file = re.findall(pattern, command.stderr)
if file:
file = file[0]
dir = file[0:file.rfind('/')]
formatme = shells.and_('mkdir -p {}', '{}')
return formatme.format(dir, command.script)
开发者ID:ApeironWang,项目名称:thefuck,代码行数:10,代码来源:no_such_file.py
示例4: get_new_command
def get_new_command(command):
missing_file = re.findall(
r"error: pathspec '([^']*)' "
r"did not match any file\(s\) known to git.", command.stderr)[0]
closest_branch = utils.get_closest(missing_file, get_branches(),
fallback_to_first=False)
if closest_branch:
return replace_argument(command.script, missing_file, closest_branch)
else:
return shells.and_('git branch {}', '{}').format(
missing_file, command.script)
开发者ID:MJerty,项目名称:thefuck,代码行数:11,代码来源:git_checkout.py
示例5: get_new_command
def get_new_command(command, settings):
m = _search(command.stderr) or _search(command.stdout)
# Note: there does not seem to be a standard for columns, so they are just
# ignored by default
if settings.fixcolcmd and "col" in m.groupdict():
editor_call = settings.fixcolcmd.format(
editor=os.environ["EDITOR"], file=m.group("file"), line=m.group("line"), col=m.group("col")
)
else:
editor_call = settings.fixlinecmd.format(
editor=os.environ["EDITOR"], file=m.group("file"), line=m.group("line")
)
return shells.and_(editor_call, command.script)
开发者ID:ngphat,项目名称:thefuck,代码行数:15,代码来源:fix_file.py
示例6: get_new_command
def get_new_command(command, settings):
c = CommandNotFound.CommandNotFound()
pkgs = c.getPackages(command.script.split(" ")[0])
name, _ = pkgs[0]
formatme = shells.and_('sudo apt-get install {}', '{}')
return formatme.format(name, command.script)
开发者ID:ApeironWang,项目名称:thefuck,代码行数:6,代码来源:apt_get.py
示例7: get_new_command
def get_new_command(command):
path = re.findall(r"touch: cannot touch '(.+)/.+':", command.stderr)[0]
return and_(u'mkdir -p {}'.format(path), command.script)
开发者ID:DJMIN,项目名称:thefuck,代码行数:3,代码来源:touch.py
示例8: get_new_command
def get_new_command(command):
return shells.and_(replace_argument(command.script, 'push', 'pull'),
command.script)
开发者ID:MJerty,项目名称:thefuck,代码行数:3,代码来源:git_push_pull.py
示例9: get_new_command
def get_new_command(command, settings):
return shells.and_('mkdir -p {dir}', '{cmd} -C {dir}') \
.format(dir=_tar_file(command.script)[1], cmd=command.script)
开发者ID:roth1002,项目名称:thefuck,代码行数:3,代码来源:dirty_untar.py
示例10: get_new_command
def get_new_command(command):
return shells.and_('tsuru login', command.script)
开发者ID:MJerty,项目名称:thefuck,代码行数:2,代码来源:tsuru_login.py
示例11: get_new_command
def get_new_command(command, settings):
return shells.and_('git branch --delete list', 'git branch')
开发者ID:BaggersIO,项目名称:thefuck,代码行数:2,代码来源:git_branch_list.py
示例12: get_new_command
def get_new_command(command, settings):
return and_(replace_argument(command.script, 'push', 'pull'),
command.script)
开发者ID:SanketDG,项目名称:thefuck,代码行数:3,代码来源:git_push_pull.py
示例13: get_new_command
def get_new_command(command):
dir = shells.quote(_tar_file(command.script_parts)[1])
return shells.and_('mkdir -p {dir}', '{cmd} -C {dir}') \
.format(dir=dir, cmd=command.script)
开发者ID:flying-potato,项目名称:thefuck,代码行数:4,代码来源:dirty_untar.py
示例14: get_new_command
def get_new_command(command):
return shells.and_("mkdir -p {dir}", "{cmd} -C {dir}").format(dir=_tar_file(command.script)[1], cmd=command.script)
开发者ID:DJMIN,项目名称:thefuck,代码行数:2,代码来源:dirty_untar.py
示例15: get_new_command
def get_new_command(command, settings):
return shells.and_(replace_argument(command.script, "push", "pull"), command.script)
开发者ID:Aftermath,项目名称:thefuck,代码行数:2,代码来源:git_push_pull.py
示例16: get_new_command
def get_new_command(command, settings):
line = command.stderr.split('\n')[-3].strip()
branch = line.split(' ')[-1]
set_upstream = line.replace('<remote>', 'origin')\
.replace('<branch>', branch)
return shells.and_(set_upstream, command.script)
开发者ID:subajat1,项目名称:thefuck,代码行数:6,代码来源:git_pull.py
示例17: test_get_new_command
def test_get_new_command():
assert (get_new_command(Command('git branch list'), None) ==
shells.and_('git branch --delete list', 'git branch'))
开发者ID:ngphat,项目名称:thefuck,代码行数:3,代码来源:test_git_branch_list.py
示例18: get_new_command
def get_new_command(command):
name = get_package(command.script)
formatme = shells.and_('sudo apt-get install {}', '{}')
return formatme.format(name, command.script)
开发者ID:MJerty,项目名称:thefuck,代码行数:4,代码来源:apt_get.py
示例19: get_new_command
def get_new_command(command):
repl = shells.and_('mkdir -p \\1', 'cd \\1')
return re.sub(r'^cd (.*)', repl, command.script)
开发者ID:amir-s,项目名称:thefuck,代码行数:3,代码来源:cd_mkdir.py
示例20: get_new_command
def get_new_command(command):
formatme = shells.and_('git stash', '{}')
return formatme.format(command.script)
开发者ID:MJerty,项目名称:thefuck,代码行数:3,代码来源:git_stash.py
注:本文中的thefuck.shells.and_函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论