Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Default init path to CWD (like NPM init) #26

Closed
FokkeZB opened this issue Feb 24, 2017 · 5 comments
Closed

Default init path to CWD (like NPM init) #26

FokkeZB opened this issue Feb 24, 2017 · 5 comments

Comments

@FokkeZB
Copy link
Contributor

FokkeZB commented Feb 24, 2017

Currently if you leave out the path it neither refuses to run nor complete successfully. It should do either, and my suggestion is to default to the current working directory, like npm init does.

MacBook-Pro-van-Fokke:swagger fokkezb$ zapier init
Initializes a new Zapier app in a directory.

Usage: `zapier init path`

Initializes a new Zapier app. If you specify a template, will download and install the app from that template.

After running this, you'll have a new example app in your directory. If you re-run this command on an existing directory it will leave existing files alone and not clobber them.

> Note: this doesn't register or deploy the app with Zapier - try zapier register "Example" and zapier push for that!

**Arguments**

* location [value] -- **required**,
* --template={minimal,resource,trigger,create,search,middleware,basic-auth,custom-auth,oauth2,session-auth,babel} -- _optional_, select a starting app template. Default is minimal

$ zapier init example-app --template=minimal
# Let's initialize your app!
#
#   Downloading zapier/zapier-platform-example-app-minimal starter app - done!
#   Copy /users/username/code/example-app/.gitignore - done!
#   Copy /users/username/code/example-app/index.js - done!
#   Copy /users/username/code/example-app/package.json - done!
#   Copy /users/username/code/example-app/test/index.js - done!
#
# Finished! You might need to npm install then try zapier test!

Errors running command `zapier init`:

!!!   Missing required positional argument 1/location

MacBook-Pro-van-Fokke:swagger fokkezb$ zapier init .
Welcome to the Zapier Platform! :-D

                zzzzzzzz
      zzz       zzzzzzzz       zzz
    zzzzzzz     zzzzzzzz     zzzzzzz
   zzzzzzzzzz   zzzzzzzz   zzzzzzzzzz
      zzzzzzzzz zzzzzzzz zzzzzzzzz
        zzzzzzzzzzzzzzzzzzzzzzzz
          zzzzzzzzzzzzzzzzzzzz
zzzzzzzzzzzzzzz          zzzzzzzzzzzzzzz
zzzzzzzzzzzzzzz          zzzzzzzzzzzzzzz
zzzzzzzzzzzzzzz          zzzzzzzzzzzzzzz
zzzzzzzzzzzzzzz          zzzzzzzzzzzzzzz
          zzzzzzzzzzzzzzzzzzzz
        zzzzzzzzzzzzzzzzzzzzzzzz
      zzzzzzzzz zzzzzzzz zzzzzzzzz
   zzzzzzzzzz   zzzzzzzz   zzzzzzzzzz
    zzzzzzz     zzzzzzzz     zzzzzzz
      zzz       zzzzzzzz       zzz
                zzzzzzzz

Let's initialize your app!

  Downloading zapier/zapier-platform-example-app-minimal starter app - done!
  Copy /Users/fokkezb/Documents/Zapier/Code/swagger/.gitignore - done!
  Copy /Users/fokkezb/Documents/Zapier/Code/swagger/index.js - done!
  Copy /Users/fokkezb/Documents/Zapier/Code/swagger/package.json - done!
  Copy /Users/fokkezb/Documents/Zapier/Code/swagger/test/index.js - done!

Finished! You might need to `npm install` then try `zapier test`!
@bryanhelmig
Copy link
Member

bryanhelmig commented Feb 24, 2017

I'm not a huge fan of this - as it could clobber your working directory. npm has a lot of "inbuilt" knowledge of it being used in the working directory. Compare that to pip which is all about the current virtualenv (and doesn't care at all about working directory).

@FokkeZB
Copy link
Contributor Author

FokkeZB commented Feb 24, 2017

Still I think since these apps are NodeJS and even more because the command is "init" (not "create") it makes sense to follow existing patterns in that ecosystem.

But if we don't, then at least the command should fail right away IMHO since with this much output before the error, it's easy to miss - in particular in a B/W console.

@bryanhelmig
Copy link
Member

bryanhelmig commented Feb 24, 2017

I am really uncomfortable with the level of setup we do (creating files, folders, etc.) without an explicit location argument.

Maybe we don't print help right away but suggest it? Definitely cluttered as is and hides the error message.

@FokkeZB
Copy link
Contributor Author

FokkeZB commented Feb 25, 2017

Let's clean it up then, since in particular the last line of help is confusing if it's printed just before the error. You could think it actually did finish:

# Finished! You might need to npm install then try zapier test!

Errors running command `zapier init`:

!!!   Missing required positional argument 1/location

I'd prefer:

$ zapier init
Error: Missing required argument 'path'

Run `zapier help init` for usage.

$

@bryanhelmig
Copy link
Member

Closing for #30.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants