Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env python3
import sys
import re
def jobs_line(string):
return re.match(
r"^\[(?P<id>\d+)\]\s+(?P<default>\+|-)?\s+(?P<state>.*?)\s+(?P<rest>.*)", string
# I may need something more sophisticated in future
def is_vim(rest):
return "vim" in rest
if __name__ == "__main__":
if sys.stdin.isatty():
sys.stderr.write("Usage: jobs | {}".format(sys.argv[0]))
data ="\n")
data = map(jobs_line, data)
for d in data:
if is_vim(d["rest"]):
print("fg %{id}".format_map(d))
print("/usr/bin/env vim")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.