Clasp: The [--version] option of pull doesn't work

Created on 27 Sep 2018  路  5Comments  路  Source: google/clasp

The Apps Script API now allows to retrieve the source code of past versions. With clasp, this was made possible thanks to the [--version] option in the pull command:
clasp pull --version 23

But this command returns the current version of clasp (currently returns 1.5.3) instead of pulling the source code of a specified version of an Apps Script project.

Most helpful comment

Cause

--version option is conflict clasp --version and clasp pull --version 23.
commander.js is not accept same option in global command and sub-command.

Solution

I consider that solution is any of following to:

  1. Use --versionNumber option instead of --version option.
  2. In pull sub-command, use argument instead of --version option to specify version number. (ex: clasp pull 23)

All 5 comments

Cause

--version option is conflict clasp --version and clasp pull --version 23.
commander.js is not accept same option in global command and sub-command.

Solution

I consider that solution is any of following to:

  1. Use --versionNumber option instead of --version option.
  2. In pull sub-command, use argument instead of --version option to specify version number. (ex: clasp pull 23)

@RomainVialard @fossamagna Good catch!
I think clasp pull -v 23 would be good. Let's change to this.
clasp pull 23 may be OK, but it would prevent other extensions to getContents in the future.

In general, I try to mirror the API, which uses versionNumber instead of projectVersion:
https://developers.google.com/apps-script/api/reference/rest/v1/projects/getContent
But I think -v would be simpler and make sense to JavaScript developers.

@grant note that clasp pull -v 23 currently returns Clasp version number, exactly like clasp pull --version 23 (ie it conflicts with clasp -v exactly like clasp pull --version 23 conflicts with clasp --version)

OK. Then let's use --versionNumber like @fossamagna suggested?

Sure

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hariharasuthan-balaji picture hariharasuthan-balaji  路  8Comments

Haris-Jamil picture Haris-Jamil  路  6Comments

imthenachoman picture imthenachoman  路  3Comments

grant picture grant  路  8Comments

grant picture grant  路  3Comments