This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 2 files changed +9
-15
lines changed
2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ module.exports = {
27
27
sort : {
28
28
alias : 's' ,
29
29
type : 'boolean' ,
30
- default : false ,
30
+ default : true ,
31
31
coerce : asBoolean ,
32
32
describe : 'Sort entries by name'
33
33
} ,
@@ -55,6 +55,13 @@ module.exports = {
55
55
cidBase
56
56
} )
57
57
. then ( files => {
58
+ // https://github.com./ipfs/go-ipfs/issues/5181
59
+ if ( sort ) {
60
+ return callback ( null , files . sort ( ( a , b ) => {
61
+ return a . name . localeCompare ( b . name )
62
+ } ) )
63
+ }
64
+
58
65
if ( long ) {
59
66
files . forEach ( link => {
60
67
print ( `${ link . name } \t${ link . hash } \t${ link . size } ` )
Original file line number Diff line number Diff line change @@ -22,20 +22,7 @@ module.exports = (context) => {
22
22
23
23
pull (
24
24
lsPullStream ( context ) ( path , options ) ,
25
- collect ( ( err , files ) => {
26
- if ( err ) {
27
- return callback ( err )
28
- }
29
-
30
- // https://github.com./ipfs/go-ipfs/issues/5181
31
- if ( options . sort ) {
32
- return callback ( null , files . sort ( ( a , b ) => {
33
- return a . name . localeCompare ( b . name )
34
- } ) )
35
- }
36
-
37
- return callback ( null , files )
38
- } )
25
+ collect ( callback )
39
26
)
40
27
}
41
28
}
You can’t perform that action at this time.
0 commit comments