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

feat: jsipfs ls -r (Recursive list directory) #1222

Merged
merged 20 commits into from
Feb 21, 2018

Conversation

JonKrone
Copy link
Contributor

@JonKrone JonKrone commented Feb 16, 2018

Adds an -r flag to ipfs ls.

image

This is just a minor change with a little bit of cleanup. Moves the ls cli tests to their own suite and prints a deprecation notice on ipfs file ls.

I thought there might be useful information to show under an option like ls -l but I don't know of any information available that's important enough. I was at various times a little confused by the three ls commands, file ls files ls and ls, and how they differed and inherited so I hope I've consolidated them into a single impl.

Requires a small change to js-ipfs-api: ipfs-inactive/js-ipfs-http-client#693

related issue: https://github.com/ipfs/interface-ipfs-core/issues/92

daviddias
daviddias previously approved these changes Feb 16, 2018
Copy link
Member

@daviddias daviddias left a comment

Choose a reason for hiding this comment

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

LGTM as long as CI is passing :) Thanks @JonKrone !!

@@ -11,6 +11,8 @@ module.exports = {

handler (argv) {
let path = argv.key
// `ipfs file ls` is deprecated. See https://ipfs.io/docs/commands/#ipfs-file-ls
print(`This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.`)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should be suggesting files ls, right? per ipfs/specs#98 (comment)
copied this from ipfs.io, will change.

Copy link
Member

Choose a reason for hiding this comment

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

Still just ipfs ls for now until both APIs are united. Currently, ipfs ls !== ipfs files ls

Copy link
Contributor Author

@JonKrone JonKrone Feb 19, 2018

Choose a reason for hiding this comment

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

Yeah, I thought so but was a bit confused here. Tracing code, I found that ipfs ls is an alias of ipfs files ls in js-ipfs/core -

this.ls = this.files.lsImmutable

There is also no /files/ls route handler in js-ipfs and a jsipfs files ls command with a daemon running triggers a js-ipfs-api /ls, not /files/ls, request. So there are a couple places where it seems ipfs ls == ipfs files ls. I'm sure there's something that I'm missing, let's go over it Wednesday.

@daviddias
Copy link
Member

@JonKrone could you rebase master onto this branch for a clean merge (CI green)?

@daviddias daviddias changed the title Recursive list directory feat: jsipfs ls -r (Recursive list directory) Feb 18, 2018
@daviddias daviddias added the status/in-progress In progress label Feb 19, 2018
@daviddias
Copy link
Member

@JonKrone just released the js-ipfs-api update you needed. Once you update the deps here you should be all good :)

})

it('recursively follows folders, -r', function () {
this.slow(2000)
Copy link
Member

Choose a reason for hiding this comment

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

@JonKrone what does this call do?

Copy link
Member

Choose a reason for hiding this comment

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

got it, it tells mocha to inform us that it is slow after 2000ms.

@daviddias daviddias merged commit 0f1e00f into ipfs:master Feb 21, 2018
@ghost ghost removed the status/in-progress In progress label Feb 21, 2018
@JonKrone JonKrone deleted the feat/ls-at-lsImmutable branch March 3, 2018 20:07
JonKrone added a commit to JonKrone/js-ipfs that referenced this pull request Mar 3, 2018
JonKrone added a commit to JonKrone/js-ipfs that referenced this pull request Mar 3, 2018
MicrowaveDev pushed a commit to galtproject/js-ipfs that referenced this pull request May 22, 2020
* fix: change name-api examples to new api

* fix: change files-api example to new api

* fix: change upload example to new api

* fix: change bundle-webpack to support new api

* fix: remove browserify example

doesnt support imports

* fix: change pubsub example to the new api

* Update examples/bundle-webpack/src/App.js

Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai>

* Update examples/bundle-webpack/src/App.js

Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai>

* Update examples/files-api/files-api.js

Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai>

* Update examples/upload-file-via-browser/src/App.js

Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai>

* Update examples/upload-file-via-browser/src/App.js

Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai>

Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants