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

Commit

Permalink
fix: remove non existent commands (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Jul 23, 2017
1 parent c90ca22 commit b7e8e88
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 149 deletions.
42 changes: 17 additions & 25 deletions src/cli/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,25 @@ const args = process.argv.slice(2)
// Need to skip to avoid locking as these commands
// don't require a daemon
if (args[0] === 'daemon' || args[0] === 'init') {
return cli
cli
.help()
.strict(false)
.completion()
.parse(args)
}

utils.getIPFS((err, ipfs, cleanup) => {
if (err) {
throw err
}

// finalize cli setup
cli // eslint-disable-line
.help()
.strict(false)
.completion()
.parse(args, {
ipfs: ipfs
}, (err, argv, output) => {
if (output) {
console.log(output)
}
cleanup(() => {
if (err) {
throw err
}
} else {
utils.getIPFS((err, ipfs, cleanup) => {
if (err) { throw err }

cli
.help()
.strict(false)
.completion()
.parse(args, { ipfs: ipfs }, (err, argv, output) => {
if (output) { console.log(output) }

cleanup(() => {
if (err) { throw err }
})
})
})
})
})
}
6 changes: 3 additions & 3 deletions src/cli/commands/bitswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
module.exports = {
command: 'bitswap',

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

builder (yargs) {
return yargs
.commandDir('bitswap')
return yargs.commandDir('bitswap')
},

handler (argv) {
console.log('Type `jsipfs bitswap --help` for more information about this command')
}
}
10 changes: 0 additions & 10 deletions src/cli/commands/dns.js

This file was deleted.

6 changes: 4 additions & 2 deletions src/cli/commands/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
module.exports = {
command: 'files',

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

builder (yargs) {
return yargs
.commandDir('files')
},

handler (argv) {}
handler (argv) {
console.log('Type `jsipfs bitswap --help` for more instructions')
}
}
92 changes: 46 additions & 46 deletions src/cli/commands/files/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,52 @@ function checkPath (inPath, recursive) {
return inPath
}

function addPipeline (index, addStream, list, wrapWithDirectory) {
pull(
zip(
pull.values(list),
pull(
pull.values(list),
paramap(fs.stat.bind(fs), 50)
)
),
pull.map((pair) => ({
path: pair[0],
isDirectory: pair[1].isDirectory()
})),
pull.filter((file) => !file.isDirectory),
pull.map((file) => ({
path: file.path.substring(index, file.path.length),
originalPath: file.path
})),
pull.map((file) => ({
path: wrapWithDirectory ? path.join(WRAPPER, file.path) : file.path,
content: fs.createReadStream(file.originalPath)
})),
addStream,
pull.map((file) => ({
hash: file.hash,
path: wrapWithDirectory ? file.path.substring(WRAPPER.length) : file.path
})),
pull.collect((err, added) => {
if (err) {
throw err
}

sortBy(added, 'path')
.reverse()
.map((file) => {
const log = [ 'added', file.hash ]

if (file.path.length > 0) log.push(file.path)

return log.join(' ')
})
.forEach((msg) => console.log(msg))
})
)
}

module.exports = {
command: 'add <file>',

Expand Down Expand Up @@ -112,49 +158,3 @@ module.exports = {
})
}
}

function addPipeline (index, addStream, list, wrapWithDirectory) {
pull(
zip(
pull.values(list),
pull(
pull.values(list),
paramap(fs.stat.bind(fs), 50)
)
),
pull.map((pair) => ({
path: pair[0],
isDirectory: pair[1].isDirectory()
})),
pull.filter((file) => !file.isDirectory),
pull.map((file) => ({
path: file.path.substring(index, file.path.length),
originalPath: file.path
})),
pull.map((file) => ({
path: wrapWithDirectory ? path.join(WRAPPER, file.path) : file.path,
content: fs.createReadStream(file.originalPath)
})),
addStream,
pull.map((file) => ({
hash: file.hash,
path: wrapWithDirectory ? file.path.substring(WRAPPER.length) : file.path
})),
pull.collect((err, added) => {
if (err) {
throw err
}

sortBy(added, 'path')
.reverse()
.map((file) => {
const log = [ 'added', file.hash ]

if (file.path.length > 0) log.push(file.path)

return log.join(' ')
})
.forEach((msg) => console.log(msg))
})
)
}
2 changes: 1 addition & 1 deletion src/cli/commands/files/cat.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module.exports = {
command: 'cat <ipfs-path>',

describe: 'Download IPFS objects',
describe: 'Fetch and cat an IPFS path referencing a file',

builder: {},

Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/files/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function fileHandler (dir) {
module.exports = {
command: 'get <ipfs-path>',

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

builder: {
output: {
Expand Down
10 changes: 0 additions & 10 deletions src/cli/commands/ls.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/cli/commands/mount.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/cli/commands/ping.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/cli/commands/refs.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/cli/commands/resolve.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/cli/commands/update.js

This file was deleted.

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

const commandCount = 63
const commandCount = 56

describe('commands', () => runOnAndOff((thing) => {
let ipfs
Expand Down

0 comments on commit b7e8e88

Please sign in to comment.