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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ clasp
- `clasp clone <scriptId>`
- `clasp pull`
- `clasp push`
- `clasp open`
- `clasp open [scriptId]`
- `clasp deployments`
- `clasp deploy [version] [description]`
- `clasp redeploy <deploymentId> <version> <description>`
Expand Down Expand Up @@ -107,9 +107,11 @@ clasp deployments # List all deployment IDs
### Open the Project on script.google.com

```
clasp open
clasp open [scriptId]
```

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

### List your App Scripts (In Development)

```
Expand Down
26 changes: 15 additions & 11 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,19 +628,23 @@ commander
* Opens the script editor in the user's browser.
*/
commander
.command('open')
.command('open [scriptId]')
.description('Open a script')
.action((scriptId: string) => {
getProjectSettings().then(async ({ scriptId }: ProjectSettings) => {
if (scriptId) {
if (scriptId.length < 30) {
logError(null, ERROR.SCRIPT_ID_INCORRECT(scriptId));
} else {
console.log(LOG.OPEN_PROJECT(scriptId));
open(getScriptURL(scriptId));
}
.action(async (scriptId: string) => {
const openScript = (scriptId?) => {
if (!scriptId) return;
if (scriptId.length < 30) {
logError(null, ERROR.SCRIPT_ID_INCORRECT(scriptId));
} else {
console.log(LOG.OPEN_PROJECT(scriptId));
open(getScriptURL(scriptId));
}
});
};
if (scriptId) {
openScript(scriptId);
} else {
getProjectSettings().then(openScript);
}
});

/**
Expand Down