Skip to content

Commit

Permalink
experimental fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PopGoesTheWza committed Jan 13, 2020
1 parent b26807a commit 5844cc2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ async function authorizeWithLocalhost(
});
const authUrl = client.generateAuthUrl(oAuth2ClientAuthUrlOpts);
console.log(LOG.AUTHORIZE(authUrl));
open(authUrl);
const escapeDoubleQuoteOnWindows = (url: string): string => process.platform === "win32" ? url.replace(/"/g, '%22') : url;
open(escapeDoubleQuoteOnWindows(authUrl));
});
server.close();
return (await client.getToken(authCode)).tokens;
Expand Down
7 changes: 4 additions & 3 deletions src/commands/apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ export default async (options: { open?: string }) => {
if (options.open) {
const apisUrl = URL.APIS(await getProjectId());
console.log(apisUrl);
await open(apisUrl);
process.exit();
// return;
const escapeDoubleQuoteOnWindows = (url: string): string => process.platform === "win32" ? url.replace(/"/g, '%22') : url;
await open(escapeDoubleQuoteOnWindows(apisUrl));
// process.exit();
return;
}

// The apis subcommands.
Expand Down
7 changes: 4 additions & 3 deletions src/commands/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ export default async (cmd: {
if (cmd.open) {
const url = URL.LOGS(projectId);
console.log(`Opening logs: ${url}`);
await open(url);
process.exit();
// return;
const escapeDoubleQuoteOnWindows = (url: string): string => process.platform === "win32" ? url.replace(/"/g, '%22') : url;
await open(escapeDoubleQuoteOnWindows(url));
// process.exit();
return;
}

// Otherwise, if not opening StackDriver, load StackDriver logs.
Expand Down
21 changes: 12 additions & 9 deletions src/commands/openCmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ export default async (
const projectId = projectSettings.projectId;
if (projectId) {
console.log(LOG.OPEN_CREDS(projectId));
await open(URL.CREDS(projectId));
process.exit();
// return;
const escapeDoubleQuoteOnWindows = (url: string): string => process.platform === "win32" ? url.replace(/"/g, '%22') : url;
await open(escapeDoubleQuoteOnWindows(URL.CREDS(projectId)));
// process.exit();
return;
}
logError(null, ERROR.NO_GCLOUD_PROJECT);
}

// If we're not a web app, open the script URL.
if (!cmd.webapp) {
console.log(LOG.OPEN_PROJECT(scriptId));
await open(URL.SCRIPT(scriptId));
process.exit();
// return;
const escapeDoubleQuoteOnWindows = (url: string): string => process.platform === "win32" ? url.replace(/"/g, '%22') : url;
await open(escapeDoubleQuoteOnWindows(URL.SCRIPT(scriptId)));
// process.exit();
return;
}

// Web app: Otherwise, open the latest deployment.
Expand Down Expand Up @@ -86,9 +88,10 @@ export default async (
console.log(LOG.OPEN_WEBAPP(answers.deployment.deploymentId));
const target = getWebApplicationURL(deployment.data);
if (target) {
await open(target, { wait: false });
process.exit();
// return;
const escapeDoubleQuoteOnWindows = (url: string): string => process.platform === "win32" ? url.replace(/"/g, '%22') : url;
await open(escapeDoubleQuoteOnWindows(target));
// process.exit();
return;
} else {
logError(null, `Could not open deployment: ${deployment}`);
}
Expand Down

0 comments on commit 5844cc2

Please sign in to comment.