-
Notifications
You must be signed in to change notification settings - Fork 839
Support for GitHub and Jujitsu CLIs #1551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
qubitz
wants to merge
2
commits into
talonhub:main
Choose a base branch
from
qubitz:jujitsu-github-commands
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| Option, Spoken form | ||
| --help, help | ||
| cancel | ||
| checkout | ||
| checks | ||
| clone | ||
| close | ||
| comment | ||
| create | ||
| delete | ||
| diff | ||
| disable | ||
| download | ||
| edit | ||
| enable | ||
| fork | ||
| list | ||
| lock | ||
| login | ||
| logout | ||
| merge | ||
| ready | ||
| refresh | ||
| rename | ||
| reopen | ||
| rerun | ||
| review | ||
| run | ||
| setup-git, setup get | ||
| status | ||
| switch | ||
| sync | ||
| token | ||
| unlock | ||
| upload | ||
| view | ||
| watch |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import csv | ||
| from pathlib import Path | ||
|
|
||
| from talon import Context, Module, resource | ||
|
|
||
| mod = Module() | ||
| ctx = Context() | ||
|
|
||
| mod.list("github_command", desc="Github commands.") | ||
| mod.list("github_argument", desc="Command-line github options and arguments.") | ||
|
|
||
| dirpath = Path(__file__).parent | ||
| arguments_csv_path = str(dirpath / "github_arguments.csv") | ||
| commands_csv_path = str(dirpath / "github_commands.csv") | ||
|
|
||
|
|
||
| def make_list(path): | ||
| with resource.open(path, "r") as f: | ||
| rows = list(csv.reader(f)) | ||
| mapping = {} | ||
| # ignore header row | ||
| for row in rows[1:]: | ||
| if len(row) == 0: | ||
| continue | ||
| if len(row) == 1: | ||
| row = row[0], row[0] | ||
| if len(row) > 2: | ||
| print("{path!r}: More than two values in row: {row}. Ignoring the extras.") | ||
| output, spoken_form = row[:2] | ||
| spoken_form = spoken_form.strip() | ||
| mapping[spoken_form] = output | ||
| return mapping | ||
|
|
||
|
|
||
| ctx.lists["self.github_argument"] = make_list(arguments_csv_path) | ||
| ctx.lists["self.github_command"] = make_list(commands_csv_path) | ||
|
|
||
|
|
||
| @mod.capture(rule="{user.github_argument}+") | ||
| def github_arguments(m) -> str: | ||
| """A non-empty sequence of github command arguments, preceded by a space.""" | ||
| return " " + " ".join(m.github_argument_list) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| tag: terminal | ||
| and tag: user.git | ||
| - | ||
| get hub {user.github_command} [<user.github_arguments>]: | ||
| args = github_arguments or "" | ||
| "gh {github_command}{args} " | ||
|
|
||
| # Convenience | ||
| github repo clone clipboard: | ||
| insert("gh repo clone ") | ||
| edit.paste() | ||
| key(enter) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| Subcommand, Spoken form (optional) | ||
| auth, authenticate | ||
| browse | ||
| codespace, code space | ||
| gist | ||
| issue | ||
| org | ||
| project | ||
| release | ||
| pr, request | ||
| repo | ||
| run | ||
| workflow |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import csv | ||
| import os | ||
| from pathlib import Path | ||
|
|
||
| from talon import Context, Module, resource | ||
|
|
||
| mod = Module() | ||
| ctx = Context() | ||
|
|
||
| mod.list("jujitsu_command", desc="jujitsu commands.") | ||
| mod.list("jujitsu_argument", desc="Command-line jujitsu options and arguments.") | ||
|
|
||
| dirpath = Path(__file__).parent | ||
| arguments_csv_path = str(dirpath / "jujitsu_arguments.csv") | ||
| commands_csv_path = str(dirpath / "jujitsu_commands.csv") | ||
|
|
||
|
|
||
| def make_list(path): | ||
| with resource.open(path, "r") as f: | ||
| rows = list(csv.reader(f)) | ||
| mapping = {} | ||
| # ignore header row | ||
| for row in rows[1:]: | ||
| if len(row) == 0: | ||
| continue | ||
| if len(row) == 1: | ||
| row = row[0], row[0] | ||
| if len(row) > 2: | ||
| print("{path!r}: More than two values in row: {row}. Ignoring the extras.") | ||
| output, spoken_form = row[:2] | ||
| spoken_form = spoken_form.strip() | ||
| mapping[spoken_form] = output | ||
| return mapping | ||
|
|
||
|
|
||
| ctx.lists["self.jujitsu_argument"] = make_list(arguments_csv_path) | ||
| ctx.lists["self.jujitsu_command"] = make_list(commands_csv_path) | ||
|
|
||
|
|
||
| @mod.capture(rule="{user.jujitsu_argument}+") | ||
| def jujitsu_arguments(m) -> str: | ||
| """A non-empty sequence of jujitsu command arguments, preceded by a space.""" | ||
| return " " + " ".join(m.jujitsu_argument_list) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| tag: terminal | ||
| and tag: user.git | ||
| - | ||
| jojo {user.jujitsu_command} [<user.jujitsu_arguments>]: | ||
| args = jujitsu_arguments or "" | ||
| "jj {jujitsu_command}{args} " | ||
| jojo describe [<user.jujitsu_arguments>] message [<user.prose>]: | ||
| args = jujitsu_arguments or "" | ||
| message = prose or "" | ||
| user.insert_between('jj describe{args} --message "{message}', '"') | ||
| jojo new [<user.jujitsu_arguments>] message [<user.prose>]: | ||
| args = jujitsu_arguments or "" | ||
| message = prose or "" | ||
| user.insert_between('jj new{args} --message "{message}', '"') | ||
| jojo commit [<user.jujitsu_arguments>] message [<user.prose>]: | ||
| args = jujitsu_arguments or "" | ||
| message = prose or "" | ||
| user.insert_between('jj commit{args} --message "{message}', '"') | ||
|
|
||
| # Optimistic execution for frequently used commands that are harmless (don't | ||
| # change repository or index state). | ||
| jojo status$: "jj status\n" | ||
| jojo show head$: "jj show HEAD\n" | ||
| jojo diff head$: "jj diff\n" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| Option, Spoken form | ||
| --add, add | ||
| --allow-backwards, allow backwards | ||
| --clear, clear | ||
| --colocate, colocate | ||
| --destination, destination | ||
| --dry-run, dry run | ||
| --from, from | ||
| --ignore-immutable, ignore immutable | ||
| --ignore-working-copy, ignore working copy | ||
| --insert-after, insert after | ||
| --insert-before, insert before | ||
| --interactive, interactive | ||
| --into, into | ||
| -h, help | ||
| --help, more help | ||
| --limit, limit | ||
| --no-edit, no edit | ||
| --no-pager, no pager | ||
| --patch, patch | ||
| --quiet, quiet | ||
| --remove, remove | ||
| --repo, repo | ||
| --repository, repository | ||
| --reset-author, reset author | ||
| --reversed, reversed | ||
| -r, revision | ||
| -r, revisions | ||
| --skip-empty, skip empty | ||
| --source, source | ||
| --stdin, standard in | ||
| --summary, summary | ||
| --to, to | ||
| --user, user | ||
| --what, what |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| Subcommand, Spoken form (optional) | ||
| abandon | ||
| backout, back out | ||
| branch | ||
| branch create | ||
| branch delete | ||
| branch forget | ||
| branch list | ||
| branch rename | ||
| branch set | ||
| branch track | ||
| branch untrack, branch un track | ||
| cat | ||
| chmod, change mod | ||
| config | ||
| config edit | ||
| config get | ||
| config list | ||
| config path | ||
| config set | ||
| describe | ||
| diff | ||
| diffedit | ||
| duplicate | ||
| edit | ||
| files | ||
| fix | ||
| git | ||
| git clone | ||
| git export | ||
| git fetch | ||
| git import | ||
| git init, git initialize | ||
| git push | ||
| git remote | ||
| git remote add | ||
| git remote list | ||
| git remote remove | ||
| git remote rename | ||
| help | ||
| init, in it | ||
| interdiff, intersect diff | ||
| log | ||
| new | ||
| next | ||
| obslog, object log | ||
| operation | ||
| operation abandon | ||
| operation log | ||
| operation restore | ||
| operation undo | ||
| parallelize | ||
| prev, previous | ||
| rebase | ||
| resolve | ||
| restore | ||
| root | ||
| show | ||
| sparse | ||
| sparse edit | ||
| sparse list | ||
| sparse reset | ||
| sparse set | ||
| split | ||
| squash | ||
| status | ||
| Subcommand, Spoken form (optional) | ||
| tag | ||
| tag list | ||
| undo | ||
| unsquash, un squash | ||
| untrack, un track | ||
| version | ||
| workspace | ||
| workspace add | ||
| workspace forget | ||
| workspace list | ||
| workspace root | ||
| workspace update-stale, workspace update stale | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an interesting subcommand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅 auto sort.