ecf2240b061215224e9502f6c0569dfc66e58ebc

Author
Alexey Györi <Alexey.gyoeri@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

arcanist: add functions which allow copy-pasting of URLS (#8688)

Co-authored-by: Marc Cornellà <marc.cornella@live.com>

Diff

 1diff --git a/plugins/arcanist/README.md b/plugins/arcanist/README.md
 2index 9c15f09b56fe395e96b47b0ded645d10c1d4705d..f49e4344ba7c497811771a0bd15c0f017cc932f2 100644
 3--- a/plugins/arcanist/README.md
 4+++ b/plugins/arcanist/README.md
 5@@ -11,13 +11,14 @@ plugins=(... arcanist)
 6 ## Aliases
 7 
 8 | Alias   | Command                            |
 9-|---------|------------------------------------|
10+| ------- | ---------------------------------- |
11 | ara     | `arc amend`                        |
12 | arb     | `arc branch`                       |
13 | arco    | `arc cover`                        |
14 | arci    | `arc commit`                       |
15 | ard     | `arc diff`                         |
16 | ardc    | `arc diff --create`                |
17+| ardp    | `arc diff --preview`               |
18 | ardnu   | `arc diff --nounit`                |
19 | ardnupc | `arc diff --nounit --plan-changes` |
20 | ardpc   | `arc diff --plan-changes`          |
21@@ -27,3 +28,14 @@ plugins=(... arcanist)
22 | arli    | `arc lint`                         |
23 | arls    | `arc list`                         |
24 | arpa    | `arc patch`                        |
25+
26+## Functions
27+
28+The following functions make copy pasting revision ids from the URL bar of your browser
29+easier, as they allow for copy pasting the whole URL. For example: `ardu` accepts
30+both `https://arcanist-url.com/<REVISION>` as well as `<REVISION>`.
31+
32+| Function                  | Command                           |
33+| ------------------------- | --------------------------------- |
34+| ardu [URL or revision_id] | `arc diff --update` [revision_id] |
35+| arpa [URL or revision_id] | `arc patch` [revision_id]         |
36diff --git a/plugins/arcanist/arcanist.plugin.zsh b/plugins/arcanist/arcanist.plugin.zsh
37index 8918bffdd6c27fe523e03c8a5d2d69afa61cf297..88e6713e469422fa8dc9f0f2211c0bb7febdd10a 100644
38--- a/plugins/arcanist/arcanist.plugin.zsh
39+++ b/plugins/arcanist/arcanist.plugin.zsh
40@@ -13,10 +13,25 @@ alias ardc='arc diff --create'
41 alias ardnu='arc diff --nounit'
42 alias ardnupc='arc diff --nounit --plan-changes'
43 alias ardpc='arc diff --plan-changes'
44+alias ardp='arc diff --preview' # creates a new diff in the phab interface
45 
46 alias are='arc export'
47 alias arh='arc help'
48 alias arl='arc land'
49 alias arli='arc lint'
50 alias arls='arc list'
51-alias arpa='arc patch'
52+
53+#
54+# Functions
55+# (sorted alphabetically)
56+#
57+
58+ardu() {
59+  # Both `ardu https://arcanist-url.com/<REVISION>`, and `ardu <REVISION>` work.
60+  arc diff --update "${1:t}"
61+}
62+
63+arpa() {
64+  # Both `arpa https://arcanist-url.com/<REVISION>`, and `arpa <REVISION>` work.
65+  arc patch "${1:t}"
66+}