Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion src/cli/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ module.exports = {
type: 'boolean',
default: true,
describe: 'Preload this object when adding'
},
hidden: {
alias: 'H',
type: 'boolean',
default: false,
describe: 'Include files that are hidden. Only takes effect on recursive add.'
}
},

Expand Down Expand Up @@ -153,7 +159,7 @@ module.exports = {
}

const source = argv.file
? globSource(argv.file, { recursive: argv.recursive })
? globSource(argv.file, { recursive: argv.recursive, hidden: argv.hidden })
: process.stdin // Pipe directly to ipfs.add

let finalHash
Expand Down
7 changes: 7 additions & 0 deletions test/cli/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ describe('files', () => runOnAndOff((thing) => {
expect(out).to.equal(recursiveGetDirResults.join('\n') + '\n')
})

it('add recursively including hidden files', async function () {
this.timeout(60 * 1000)

const out = await ipfs('add -r -H test/fixtures/test-data/recursive-get-dir')
expect(out).to.include('added QmdBd5zgdJQHsyaaAm9Vnth7NWwj23gj3Ew17r6bTvVkch recursive-get-dir/.hidden.txt')
})

it('add directory with trailing slash test', async function () {
this.timeout(30 * 1000)

Expand Down
1 change: 1 addition & 0 deletions test/fixtures/test-data/recursive-get-dir/.hidden.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file is hidden!