Skip to content

Commit

Permalink
Prompt for username/password
Browse files Browse the repository at this point in the history
  • Loading branch information
pepopowitz committed Aug 8, 2019
1 parent 2e2e2ee commit 8f46147
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@oclif/plugin-help": "^2",
"@types/node-fetch": "^2.5.0",
"node-fetch": "^2.6.0",
"cli-ux": "^5.3.1",
"tslib": "^1"
},
"devDependencies": {
Expand Down
8 changes: 7 additions & 1 deletion src/commands/login.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Command, flags } from "@oclif/command"
import cli from "cli-ux"

export default class Login extends Command {
static description =
Expand All @@ -12,6 +13,11 @@ export default class Login extends Command {

async run() {
// const {args, flags} = this.parse(Auth)
this.log("Authenticating against stagingapi.artsy.net...")
const username = await cli.prompt("Username", { type: "normal" })
const password = await cli.prompt("Password", { type: "hide" })

this.log(
`Authenticating against stagingapi.artsy.net with ${username}|${password}`
)
}
}
29 changes: 18 additions & 11 deletions test/commands/login.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { expect, test } from "@oclif/test"
// import { expect, test } from "@oclif/test"

describe("login", () => {
test
.stdout()
.command(["login"])
.it("lets the user know where it is authenticating", ctx => {
expect(ctx.stdout).to.contain(
"Authenticating against stagingapi.artsy.net"
)
})
})
// describe("login", () => {
// test
// .stdout()
// .command(["login"])
// .it("prompts for user and password", ctx => {
// expect(ctx.stdout).to.contain("Username:")
// })

// test
// .stdout()
// .command(["login"])
// .it("lets the user know where it is authenticating", ctx => {
// expect(ctx.stdout).to.contain(
// "Authenticating against stagingapi.artsy.net"
// )
// })
// })
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ clean-stack@^2.0.0:
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==

cli-ux@^5.2.1:
cli-ux@^5.2.1, cli-ux@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-5.3.1.tgz#3bed8b37c44b03a5d1b9d71d39a69a919a101835"
integrity sha512-l2MXbitx0FjtHKSbHytuxfxWv6MdWBRh23ItRJjU17cjj0dqZxfAL863tzbR1FIs7jccPllPUvn3QWK6BQg3Pg==
Expand Down

0 comments on commit 8f46147

Please sign in to comment.