Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
fix: improve cli output and docs (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored Oct 28, 2022
1 parent f2156aa commit 24a45d2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Commands:
w3up info Print information about cli
Global:
-p, --profile Select profile. [string] [default: "main"]
-p, --profile Select profile configuration identifier. [string] [default: "main"]
Options:
--version Show version number [boolean]
Expand Down Expand Up @@ -307,22 +307,22 @@ Once you have an identity registered with w3up, you can delegate capabilities to
> Delegate capabilities to an agent did.
```sh
w3up delegate did:12345...
✔ Wrote delegation to delegation.car
w3up delegate to did:12345...
✔ Wrote delegation to delegation.txt
```

A `delegation.car` file is generated with the UCAN delegation provided to the other agent with did `did:12345...`.
A `delegation.txt` file is generated with the UCAN delegation provided to the other agent with did `did:12345...`.

#### `w3up delegate import <fileName> [alias]`

> Import a UCAN delegation file to access capabilities delegated by other agent
```sh
w3up import-delegation delegation.car delegator
✔ Imported delegation for delegator did:key:z6M... from delegation.car successfully.
w3up import-delegation delegation.txt delegator
✔ Imported delegation for delegator did:key:z6M... from delegation.txt successfully.
```

Once a `delegation.car` is imported, you can switch to the account delegated:
Once a `delegation.txt` is imported, you can switch to the account delegated:

#### `w3up delegate switch [alias]`

Expand Down
1 change: 0 additions & 1 deletion src/commands/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const handler = async (args) => {
saveSettings(client, args.profile)

view.succeed('Agent DID: ' + identity.agent.did())
view.succeed('Account DID: ' + identity.account.did())
}
/**
* @type {import('yargs').CommandBuilder} yargs
Expand Down
6 changes: 5 additions & 1 deletion src/commands/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ async function generateCarUploads(filePath, view, chunkSize = 512, profile) {
throw new Error(uploadAddResult?.cause?.message)
}

console.log('data CIDs:\n', roots.map((x) => x.toString()).join('\n'))
console.log('upload chunk(s) identifier:\n', roots.map((x) => x.toString()).join('\n'))
console.log('car CIDs:\n', cids.map((x) => x.toString()).join('\n'))

if (roots && roots.length) {
console.log(`IPFS Gateway url:\n https://w3s.link/ipfs/${roots[0].toString()}`)
}
} catch (err) {
view.fail('Upload did not complete successfully, check w3up-failure.log')
logToFile('upload', err)
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const main = async (args = hideBin(process.argv)) => {
.option('p', {
alias: 'profile',
type: 'string',
describe: 'Select profile.',
describe: 'Select profile configuration identifier.',
default: 'main',
})
.group('profile', 'Global:')
Expand Down

0 comments on commit 24a45d2

Please sign in to comment.