Skip to content

Commit

Permalink
Merge pull request #128 from zapier/port-link-command
Browse files Browse the repository at this point in the history
refactor(cli): port link command
  • Loading branch information
xavdid committed Dec 17, 2019
2 parents 2f97e95 + f506691 commit 72193b6
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 246 deletions.
32 changes: 5 additions & 27 deletions docs/cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -757,35 +757,13 @@ <h2 id="link">link</h2>
<div class="row-height">
<div class="col-md-5 col-sm-12 col-height docs-primary">
<blockquote>
<p>Link the current directory to an app you have access to.</p>
</blockquote><p> <strong>Usage:</strong> <code>zapier link</code></p><p>Link the current directory to an app you have access to. It is fairly uncommon to run this command - more often you&apos;d just <code>git clone git@github.com:example-inc/example.git</code> which would have a <code>.zapierapprc</code> file already included. If not, you&apos;d need to be an admin on the app and use this command to regenerate the <code>.zapierapprc</code> file.</p><p>Or, if you are making an app from scratch - you should prefer <code>zapier init</code>.</p><blockquote>
<p>This will change the <code>./.zapierapprc</code> (which identifies the app assosciated with the current directory).</p>
</blockquote><p><strong>Arguments</strong></p><ul>
<li><code>--format={plain,json,raw,row,table}</code> -- <em>optional</em>, display format. Default is <code>table</code></li>
<li><code>--help</code> -- <em>optional</em>, prints this help text</li>
<li><code>--debug</code> -- <em>optional</em>, print debug API calls and tracebacks</li>
<p>Link the current directory with an existing integration</p>
</blockquote><p><strong>Usage</strong>: <code>zapier link</code></p><p>This command generates a .zapierapprc file in the directory in which it&apos;s ran. This file ties this code to an integration and is referenced frequently during <code>push</code> and <code>validate</code> operations. This file should be checked into source control.</p><p>If you&apos;re starting an integration from scratch, use <code>zapier init</code> instead.</p><p><strong>Flags</strong></p><ul>
<li><code>-d, --debug</code> | Show extra debugging output</li>
</ul>
</div>
<div class="col-md-7 col-sm-12 col-height docs-code">
<pre><code class="lang-bash">$ zapier link
<span class="hljs-comment"># Which app would you like to link the current directory to?</span>
<span class="hljs-comment">#</span>
<span class="hljs-comment"># &#x250C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x252C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x252C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x252C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x252C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2510;</span>
<span class="hljs-comment"># &#x2502; Number &#x2502; Title &#x2502; Unique Key &#x2502; Timestamp &#x2502; Linked &#x2502;</span>
<span class="hljs-comment"># &#x251C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x253C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x253C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x253C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x253C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2524;</span>
<span class="hljs-comment"># &#x2502; 1 &#x2502; Example &#x2502; Example &#x2502; 2016-01-01T22:19:28 &#x2502; &#x2714; &#x2502;</span>
<span class="hljs-comment"># &#x2514;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2534;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2534;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2534;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2534;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2518;</span>
<span class="hljs-comment"># ...or type any title to create new app!</span>
<span class="hljs-comment">#</span>
<span class="hljs-comment"># Which app number do you want to link? You also may type a new app title to create one. (Ctrl-C to cancel)</span>
<span class="hljs-comment">#</span>
1
<span class="hljs-comment">#</span>
<span class="hljs-comment"># Selecting existing app &quot;Example&quot; - done!</span>
<span class="hljs-comment"># Setting up `.zapierapprc` file - done!</span>
<span class="hljs-comment">#</span>
<span class="hljs-comment"># Finished! You can `zapier push` now to build &amp; upload a version!</span>
</code></pre>
<div class="col-md-7 col-sm-12 col-height is-empty docs-code">

</div>
</div>
</div><div class="row">
Expand Down
41 changes: 6 additions & 35 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,45 +332,16 @@ This command also checks the current directory for a linked integration.

## link

> Link the current directory to an app you have access to.
> Link the current directory with an existing integration
**Usage:** `zapier link`
**Usage**: `zapier link`


Link the current directory to an app you have access to. It is fairly uncommon to run this command - more often you'd just `git clone git@github.com:example-inc/example.git` which would have a `.zapierapprc` file already included. If not, you'd need to be an admin on the app and use this command to regenerate the `.zapierapprc` file.

Or, if you are making an app from scratch - you should prefer `zapier init`.

> This will change the `./.zapierapprc` (which identifies the app assosciated with the current directory).
**Arguments**
This command generates a .zapierapprc file in the directory in which it's ran. This file ties this code to an integration and is referenced frequently during `push` and `validate` operations. This file should be checked into source control.

If you're starting an integration from scratch, use `zapier init` instead.


* `--format={plain,json,raw,row,table}` -- _optional_, display format. Default is `table`
* `--help` -- _optional_, prints this help text
* `--debug` -- _optional_, print debug API calls and tracebacks

```bash
$ zapier link
# Which app would you like to link the current directory to?
#
# ┌────────┬─────────────┬────────────┬─────────────────────┬────────┐
# │ Number │ Title │ Unique Key │ Timestamp │ Linked │
# ├────────┼─────────────┼────────────┼─────────────────────┼────────┤
# │ 1 │ Example │ Example │ 2016-01-01T22:19:28 │ ✔ │
# └────────┴─────────────┴────────────┴─────────────────────┴────────┘
# ...or type any title to create new app!
#
# Which app number do you want to link? You also may type a new app title to create one. (Ctrl-C to cancel)
#
1
#
# Selecting existing app "Example" - done!
# Setting up `.zapierapprc` file - done!
#
# Finished! You can `zapier push` now to build & upload a version!
```
**Flags**
* `-d, --debug` | Show extra debugging output


## login
Expand Down
32 changes: 5 additions & 27 deletions packages/cli/docs/cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -757,35 +757,13 @@ <h2 id="link">link</h2>
<div class="row-height">
<div class="col-md-5 col-sm-12 col-height docs-primary">
<blockquote>
<p>Link the current directory to an app you have access to.</p>
</blockquote><p> <strong>Usage:</strong> <code>zapier link</code></p><p>Link the current directory to an app you have access to. It is fairly uncommon to run this command - more often you&apos;d just <code>git clone git@github.com:example-inc/example.git</code> which would have a <code>.zapierapprc</code> file already included. If not, you&apos;d need to be an admin on the app and use this command to regenerate the <code>.zapierapprc</code> file.</p><p>Or, if you are making an app from scratch - you should prefer <code>zapier init</code>.</p><blockquote>
<p>This will change the <code>./.zapierapprc</code> (which identifies the app assosciated with the current directory).</p>
</blockquote><p><strong>Arguments</strong></p><ul>
<li><code>--format={plain,json,raw,row,table}</code> -- <em>optional</em>, display format. Default is <code>table</code></li>
<li><code>--help</code> -- <em>optional</em>, prints this help text</li>
<li><code>--debug</code> -- <em>optional</em>, print debug API calls and tracebacks</li>
<p>Link the current directory with an existing integration</p>
</blockquote><p><strong>Usage</strong>: <code>zapier link</code></p><p>This command generates a .zapierapprc file in the directory in which it&apos;s ran. This file ties this code to an integration and is referenced frequently during <code>push</code> and <code>validate</code> operations. This file should be checked into source control.</p><p>If you&apos;re starting an integration from scratch, use <code>zapier init</code> instead.</p><p><strong>Flags</strong></p><ul>
<li><code>-d, --debug</code> | Show extra debugging output</li>
</ul>
</div>
<div class="col-md-7 col-sm-12 col-height docs-code">
<pre><code class="lang-bash">$ zapier link
<span class="hljs-comment"># Which app would you like to link the current directory to?</span>
<span class="hljs-comment">#</span>
<span class="hljs-comment"># &#x250C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x252C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x252C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x252C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x252C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2510;</span>
<span class="hljs-comment"># &#x2502; Number &#x2502; Title &#x2502; Unique Key &#x2502; Timestamp &#x2502; Linked &#x2502;</span>
<span class="hljs-comment"># &#x251C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x253C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x253C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x253C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x253C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2524;</span>
<span class="hljs-comment"># &#x2502; 1 &#x2502; Example &#x2502; Example &#x2502; 2016-01-01T22:19:28 &#x2502; &#x2714; &#x2502;</span>
<span class="hljs-comment"># &#x2514;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2534;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2534;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2534;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2534;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2518;</span>
<span class="hljs-comment"># ...or type any title to create new app!</span>
<span class="hljs-comment">#</span>
<span class="hljs-comment"># Which app number do you want to link? You also may type a new app title to create one. (Ctrl-C to cancel)</span>
<span class="hljs-comment">#</span>
1
<span class="hljs-comment">#</span>
<span class="hljs-comment"># Selecting existing app &quot;Example&quot; - done!</span>
<span class="hljs-comment"># Setting up `.zapierapprc` file - done!</span>
<span class="hljs-comment">#</span>
<span class="hljs-comment"># Finished! You can `zapier push` now to build &amp; upload a version!</span>
</code></pre>
<div class="col-md-7 col-sm-12 col-height is-empty docs-code">

</div>
</div>
</div><div class="row">
Expand Down
41 changes: 6 additions & 35 deletions packages/cli/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,45 +332,16 @@ This command also checks the current directory for a linked integration.

## link

> Link the current directory to an app you have access to.
> Link the current directory with an existing integration
**Usage:** `zapier link`
**Usage**: `zapier link`


Link the current directory to an app you have access to. It is fairly uncommon to run this command - more often you'd just `git clone git@github.com:example-inc/example.git` which would have a `.zapierapprc` file already included. If not, you'd need to be an admin on the app and use this command to regenerate the `.zapierapprc` file.

Or, if you are making an app from scratch - you should prefer `zapier init`.

> This will change the `./.zapierapprc` (which identifies the app assosciated with the current directory).
**Arguments**
This command generates a .zapierapprc file in the directory in which it's ran. This file ties this code to an integration and is referenced frequently during `push` and `validate` operations. This file should be checked into source control.

If you're starting an integration from scratch, use `zapier init` instead.


* `--format={plain,json,raw,row,table}` -- _optional_, display format. Default is `table`
* `--help` -- _optional_, prints this help text
* `--debug` -- _optional_, print debug API calls and tracebacks

```bash
$ zapier link
# Which app would you like to link the current directory to?
#
# ┌────────┬─────────────┬────────────┬─────────────────────┬────────┐
# │ Number │ Title │ Unique Key │ Timestamp │ Linked │
# ├────────┼─────────────┼────────────┼─────────────────────┼────────┤
# │ 1 │ Example │ Example │ 2016-01-01T22:19:28 │ ✔ │
# └────────┴─────────────┴────────────┴─────────────────────┴────────┘
# ...or type any title to create new app!
#
# Which app number do you want to link? You also may type a new app title to create one. (Ctrl-C to cancel)
#
1
#
# Selecting existing app "Example" - done!
# Setting up `.zapierapprc` file - done!
#
# Finished! You can `zapier push` now to build & upload a version!
```
**Flags**
* `-d, --debug` | Show extra debugging output


## login
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/commands/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
convert: require('./convert'),
help: require('./help'),
link: require('./link')
help: require('./help')
};
118 changes: 0 additions & 118 deletions packages/cli/src/commands/link.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/cli/src/oclif/ZapierBaseCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ class ZapierBaseCommand extends Command {
}

// see here for options for choices: https://github.com/SBoudrias/Inquirer.js/#question
promptWithList(question, choices) {
return this.prompt(question, { type: 'list', choices });
promptWithList(question, choices, pageSize) {
return this.prompt(question, { type: 'list', choices, pageSize });
}

/**
Expand Down
Loading

0 comments on commit 72193b6

Please sign in to comment.