Skip to content

Commit

Permalink
Various fixes (bluesky-social#97)
Browse files Browse the repository at this point in the history
* Add banner ASCII art

* Remove duplicated instructions

* Fix readme instruction

* Update the CLI prompts to use y/n/yes/no instead of t/f/true/false

* fixed boolean check on delegator prompt

Co-authored-by: dholms <[email protected]>
  • Loading branch information
pfrazee and dholms authored May 3, 2022
1 parent 1410d98 commit 351d120
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 28 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,13 @@ The number in parantheses tells you which terminal to run each command in. From
# list your feed
(3/4) yarn cli feed

# list your followers
(3/4) yarn cli list followers

# list your feed
(3/4) yarn cli feed

# view alice's feed as bob
(4) yarn cli feed alice@localhost:2583

# Keep playing around. Try unliking, deleting or editing posts, or add a third user into the mix! They can be registered to one of the existing servers

# Remember, the servers are running in-memory, if you restart a server and want to restart your CLI as well, run
(3/4) yarn destroy # deletes user repo & keypair
(3/4) yarn cli destroy # deletes user repo & keypair
```

## 🗒️ Documentation
Expand Down
9 changes: 5 additions & 4 deletions cli/src/commands/setup/destroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ export default cmd({
console.log(`Repo path: ${REPO_PATH}`)
prompt.start()
const isSure = await prompt.get({
description: 'Are you sure? This keypair will be unrecoverable',
type: 'boolean',
description: 'Are you sure? This keypair will be unrecoverable [y/N]',
type: 'string',
pattern: /y|yes|n|no/,
required: true,
default: false,
default: 'no',
})
if (!isSure.question) {
if (isSure.question === 'n' || isSure.question === 'no') {
console.log('Exiting without deleting')
return
}
Expand Down
52 changes: 35 additions & 17 deletions cli/src/commands/setup/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ export default cmd({
async command(args) {
let { username, server, register, delegatorClient } = args

console.log(`
█████╗ ██████╗ ██╗ ██╗
██╔══██╗██╔══██╗╚██╗██╔╝
███████║██║ ██║ ╚███╔╝
██╔══██║██║ ██║ ██╔██╗
██║ ██║██████╔╝██╔╝ ██╗
╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝`)

console.log(`Repo path: ${REPO_PATH}`)

const exists = await config.cfgExists(REPO_PATH)
Expand Down Expand Up @@ -52,23 +60,29 @@ export default cmd({
default: server || '',
})
).question
register = (
await prompt.get({
description: 'Register with the server?',
type: 'boolean',
required: true,
default: true,
})
).question
delegatorClient = (
await prompt.get({
description:
'Run a delegator client (and avoid storing repo locally)',
type: 'boolean',
required: true,
default: false,
})
).question
register = isYes(
(
await prompt.get({
description: 'Register with the server? [Y/n]',
type: 'string',
pattern: /y|yes|n|no/,
required: true,
default: 'yes',
})
).question,
)
delegatorClient = isYes(
(
await prompt.get({
description:
'Run a delegator client (and avoid storing repo locally) [y/N]',
type: 'string',
pattern: /y|yes|n|no/,
required: true,
default: 'no',
})
).question,
)
}

console.log('Generating repo...')
Expand All @@ -92,3 +106,7 @@ export default cmd({
console.log(`DID: ${client.did}`)
},
})

function isYes(v: string | prompt.RevalidatorSchema): boolean {
return v === 'y' || v === 'yes'
}

0 comments on commit 351d120

Please sign in to comment.