Skip to content
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

Allow clasp open to work for any scriptId #144

Merged
merged 2 commits into from Apr 26, 2018
Merged

Allow clasp open to work for any scriptId #144

merged 2 commits into from Apr 26, 2018

Conversation

campionfellin
Copy link
Collaborator

Adds optional parameter [scriptId] to clasp open command.

Signed-off-by: campionfellin campionfellin@gmail.com

Fixes #100

  • npm run test succeeds.
  • npm run lint succeeds.
  • Appropriate changes to README are included in PR.

Adds optional parameter [scriptId] to clasp open command.

Signed-off-by: campionfellin <campionfellin@gmail.com>
@coveralls
Copy link

coveralls commented Apr 25, 2018

Pull Request Test Coverage Report for Build 116

  • 0 of 0 (NaN%) changed or added relevant lines in 0 files are covered.
  • 102 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.05%) to 11.187%

Files with Coverage Reduction New Missed Lines %
index.js 102 6.92%
Totals Coverage Status
Change from base Build 112: -0.05%
Covered Lines: 108
Relevant Lines: 722

💛 - Coveralls

README.md Outdated
```

Takes an optional argument of the scriptId that you'd like to open. Else, opens script from `.clasp.json`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First describe what it does without options (90% of cases). Then describe options.

Opens the `clasp` project on script.google.com. Provide a `scriptId` to open a different script.

index.ts Outdated
if (scriptId) {
openScript(scriptId);
} else {
getProjectSettings().then(async ({ scriptId }: ProjectSettings) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's write this:

getProjectSettings().then(openScript);
const openScript = (scriptId?) => {
  if (!scriptId) return;
  // if (scriptId.length < 30) { ... length check
  // } else { ... log and open
}

In the future (when getProjectSettings is async):

const openScript = (scriptId?) => { ... }
openScript(scriptId ? scriptId : (await getProjectSettings()).scriptId);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#146 Created issue for async getProjectSettings

Copy link
Contributor

@grant grant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking as requesting changes.

Signed-off-by: campionfellin <campionfellin@gmail.com>
@grant grant merged commit 3999682 into google:master Apr 26, 2018
Copy link
Contributor

@grant grant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@campionfellin campionfellin deleted the clasp-open branch April 26, 2018 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants