Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

feat: add cid command #1560

Merged
merged 3 commits into from
Oct 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@
"boom": "^7.2.0",
"bs58": "^4.0.1",
"byteman": "^1.3.5",
"cid-tool": "~0.1.0",
"cids": "~0.5.3",
"debug": "^3.1.0",
"err-code": "^1.1.2",
21 changes: 21 additions & 0 deletions src/cli/commands/cid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict'

const path = require('path')

const cidCommandsPath = path.join(
__dirname, '..', '..', '..', 'node_modules', 'cid-tool', 'src', 'cli', 'commands'
)

module.exports = {
command: 'cid <command>',

description: 'Convert, format and discover properties of CIDs.',

builder (yargs) {
return yargs
.commandDir(cidCommandsPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woa, this is magic. Running a CLI from another CLI ⚡️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got the idea from js-ipfs-mfs ;)

},

handler (argv) {
}
}
2 changes: 1 addition & 1 deletion test/cli/commands.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
const expect = require('chai').expect
const runOnAndOff = require('../utils/on-and-off')

const commandCount = 81
const commandCount = 82
describe('commands', () => runOnAndOff((thing) => {
let ipfs