Skip to content

Commit

Permalink
merge latest main
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewuu committed Jan 3, 2024
2 parents c2d4cdd + 56a7367 commit adffad1
Show file tree
Hide file tree
Showing 4 changed files with 606 additions and 10 deletions.
29 changes: 27 additions & 2 deletions cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import logResponse from "./lib/util/log-response"
import { getApiDefinitions } from "./lib/get-api-definitions"
import commandLineUsage from "command-line-usage"
import { ContextHelpers } from "./lib/types"
import { version } from './package.json';
import { version } from "./package.json"
import open from "open"

const sections = [
{
Expand Down Expand Up @@ -69,7 +70,7 @@ async function cli(args: ParsedArgs) {
console.log(usage)
return
}

if (
!config.get(`${getServer()}.pat`) &&
args._[0] !== "login" &&
Expand Down Expand Up @@ -168,6 +169,30 @@ async function cli(args: ParsedArgs) {

logResponse(response)

if (response.data.connect_webview) {
if (
response.data &&
response.data.connect_webview &&
response.data.connect_webview.url
) {
const url = response.data.connect_webview.url

if (process.env.INSIDE_WEB_BROWSER !== "1") {
const { action } = await prompts({
type: "confirm",
name: "action",
message: "Would you like to open the webview in your browser?",
})

if (action) {
await open(url)
}
} else {
//TODO: Figure out how to open the webview in the browser
}
}
}

if ("action_attempt" in response.data) {
const { poll_for_action_attempt } = await prompts({
name: "poll_for_action_attempt",
Expand Down
137 changes: 131 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "seam-cli",
"module": "index.ts",
"type": "module",
"version": "0.0.26",
"version": "0.0.27",
"repository": "git@github.com:seamapi/seam-cli.git",
"scripts": {
"cli": "tsx ./cli.ts",
Expand Down Expand Up @@ -54,7 +54,8 @@
},
"dependencies": {
"@seamapi/http": "^0.12.0",
"@seamapi/types": "^1.72.1",
"@seamapi/types": "^1.75.0",
"open": "^10.0.2",
"swagger-parser": "^10.0.3"
}
}
Loading

0 comments on commit adffad1

Please sign in to comment.