Initial commit
This commit is contained in:
29
repl.ts
Executable file
29
repl.ts
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env ts-node-transpile-only
|
||||
import chalk from "chalk"
|
||||
import prompts from "prompts"
|
||||
import { OnePassword } from "./src/index"
|
||||
|
||||
async function main(args: string[]) {
|
||||
const instance = new OnePassword({ path: args[0] })
|
||||
const profiles = await instance.getProfileNames()
|
||||
|
||||
const { profile } = await prompts({
|
||||
type: "select",
|
||||
name: "profile",
|
||||
choices: profiles.map(t => ({ title: t, value: t })),
|
||||
message: "Which vault?",
|
||||
})
|
||||
|
||||
console.log(chalk`You have chosen {green ${profile}}.`)
|
||||
|
||||
const vault = await instance.getProfile(profile)
|
||||
const { password } = await prompts({
|
||||
type: "invisible",
|
||||
name: "password",
|
||||
message: "Master Password?",
|
||||
})
|
||||
|
||||
vault.unlock(password)
|
||||
}
|
||||
|
||||
main(process.argv.slice(2))
|
Reference in New Issue
Block a user