Last active
December 24, 2020 10:22
-
-
Save robkorv/ebee55b6a8d0d41236b51e2c9e53d3f2 to your computer and use it in GitHub Desktop.
issue_slug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import shlex | |
| import subprocess | |
| import sys | |
| import click | |
| import slugify | |
| @click.command() | |
| @click.argument("issue", type=int) | |
| def main(issue): | |
| cmd = shlex.split('hub issue show -f "%I-%t" {}'.format(issue)) | |
| result = subprocess.run(cmd, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
| if result.returncode == 0: | |
| print(slugify.slugify_url(result.stdout)) | |
| else: | |
| sys.exit(result.stdout.strip()) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment