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

Commit b7e8e88

Browse files
authored
fix: remove non existent commands (#925)
1 parent c90ca22 commit b7e8e88

File tree

14 files changed

+73
-149
lines changed

14 files changed

+73
-149
lines changed

src/cli/bin.js

+17-25
Original file line numberDiff line numberDiff line change
@@ -39,33 +39,25 @@ const args = process.argv.slice(2)
3939
// Need to skip to avoid locking as these commands
4040
// don't require a daemon
4141
if (args[0] === 'daemon' || args[0] === 'init') {
42-
return cli
42+
cli
4343
.help()
4444
.strict(false)
4545
.completion()
4646
.parse(args)
47-
}
48-
49-
utils.getIPFS((err, ipfs, cleanup) => {
50-
if (err) {
51-
throw err
52-
}
53-
54-
// finalize cli setup
55-
cli // eslint-disable-line
56-
.help()
57-
.strict(false)
58-
.completion()
59-
.parse(args, {
60-
ipfs: ipfs
61-
}, (err, argv, output) => {
62-
if (output) {
63-
console.log(output)
64-
}
65-
cleanup(() => {
66-
if (err) {
67-
throw err
68-
}
47+
} else {
48+
utils.getIPFS((err, ipfs, cleanup) => {
49+
if (err) { throw err }
50+
51+
cli
52+
.help()
53+
.strict(false)
54+
.completion()
55+
.parse(args, { ipfs: ipfs }, (err, argv, output) => {
56+
if (output) { console.log(output) }
57+
58+
cleanup(() => {
59+
if (err) { throw err }
60+
})
6961
})
70-
})
71-
})
62+
})
63+
}

src/cli/commands/bitswap.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
module.exports = {
44
command: 'bitswap',
55

6-
description: 'A set of commands to manipulate the bitswap agent.',
6+
description: 'Interact with the bitswap agent.',
77

88
builder (yargs) {
9-
return yargs
10-
.commandDir('bitswap')
9+
return yargs.commandDir('bitswap')
1110
},
1211

1312
handler (argv) {
13+
console.log('Type `jsipfs bitswap --help` for more information about this command')
1414
}
1515
}

src/cli/commands/dns.js

-10
This file was deleted.

src/cli/commands/files.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
module.exports = {
44
command: 'files',
55

6-
description: 'Unixfs commands',
6+
description: 'Operations over files (add, cat, get, ls, etc)',
77

88
builder (yargs) {
99
return yargs
1010
.commandDir('files')
1111
},
1212

13-
handler (argv) {}
13+
handler (argv) {
14+
console.log('Type `jsipfs bitswap --help` for more instructions')
15+
}
1416
}

src/cli/commands/files/add.js

+46-46
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,52 @@ function checkPath (inPath, recursive) {
3636
return inPath
3737
}
3838

39+
function addPipeline (index, addStream, list, wrapWithDirectory) {
40+
pull(
41+
zip(
42+
pull.values(list),
43+
pull(
44+
pull.values(list),
45+
paramap(fs.stat.bind(fs), 50)
46+
)
47+
),
48+
pull.map((pair) => ({
49+
path: pair[0],
50+
isDirectory: pair[1].isDirectory()
51+
})),
52+
pull.filter((file) => !file.isDirectory),
53+
pull.map((file) => ({
54+
path: file.path.substring(index, file.path.length),
55+
originalPath: file.path
56+
})),
57+
pull.map((file) => ({
58+
path: wrapWithDirectory ? path.join(WRAPPER, file.path) : file.path,
59+
content: fs.createReadStream(file.originalPath)
60+
})),
61+
addStream,
62+
pull.map((file) => ({
63+
hash: file.hash,
64+
path: wrapWithDirectory ? file.path.substring(WRAPPER.length) : file.path
65+
})),
66+
pull.collect((err, added) => {
67+
if (err) {
68+
throw err
69+
}
70+
71+
sortBy(added, 'path')
72+
.reverse()
73+
.map((file) => {
74+
const log = [ 'added', file.hash ]
75+
76+
if (file.path.length > 0) log.push(file.path)
77+
78+
return log.join(' ')
79+
})
80+
.forEach((msg) => console.log(msg))
81+
})
82+
)
83+
}
84+
3985
module.exports = {
4086
command: 'add <file>',
4187

@@ -112,49 +158,3 @@ module.exports = {
112158
})
113159
}
114160
}
115-
116-
function addPipeline (index, addStream, list, wrapWithDirectory) {
117-
pull(
118-
zip(
119-
pull.values(list),
120-
pull(
121-
pull.values(list),
122-
paramap(fs.stat.bind(fs), 50)
123-
)
124-
),
125-
pull.map((pair) => ({
126-
path: pair[0],
127-
isDirectory: pair[1].isDirectory()
128-
})),
129-
pull.filter((file) => !file.isDirectory),
130-
pull.map((file) => ({
131-
path: file.path.substring(index, file.path.length),
132-
originalPath: file.path
133-
})),
134-
pull.map((file) => ({
135-
path: wrapWithDirectory ? path.join(WRAPPER, file.path) : file.path,
136-
content: fs.createReadStream(file.originalPath)
137-
})),
138-
addStream,
139-
pull.map((file) => ({
140-
hash: file.hash,
141-
path: wrapWithDirectory ? file.path.substring(WRAPPER.length) : file.path
142-
})),
143-
pull.collect((err, added) => {
144-
if (err) {
145-
throw err
146-
}
147-
148-
sortBy(added, 'path')
149-
.reverse()
150-
.map((file) => {
151-
const log = [ 'added', file.hash ]
152-
153-
if (file.path.length > 0) log.push(file.path)
154-
155-
return log.join(' ')
156-
})
157-
.forEach((msg) => console.log(msg))
158-
})
159-
)
160-
}

src/cli/commands/files/cat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module.exports = {
44
command: 'cat <ipfs-path>',
55

6-
describe: 'Download IPFS objects',
6+
describe: 'Fetch and cat an IPFS path referencing a file',
77

88
builder: {},
99

src/cli/commands/files/get.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function fileHandler (dir) {
5050
module.exports = {
5151
command: 'get <ipfs-path>',
5252

53-
describe: 'Download IPFS objects',
53+
describe: 'Fetch a file or directory with files references from an IPFS Path',
5454

5555
builder: {
5656
output: {

src/cli/commands/ls.js

-10
This file was deleted.

src/cli/commands/mount.js

-10
This file was deleted.

src/cli/commands/ping.js

-10
This file was deleted.

src/cli/commands/refs.js

-10
This file was deleted.

src/cli/commands/resolve.js

-10
This file was deleted.

src/cli/commands/update.js

-10
This file was deleted.

test/cli/commands.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const expect = require('chai').expect
55
const runOnAndOff = require('../utils/on-and-off')
66

7-
const commandCount = 63
7+
const commandCount = 56
88

99
describe('commands', () => runOnAndOff((thing) => {
1010
let ipfs

0 commit comments

Comments
 (0)