-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hs list command to check contents of directories #354
Conversation
Nice! Re: grouping, I do think something there would be beneficial. Maybe some way to differentiate between folders and files? |
I was thinking of changing the output to look for a file extension and then assume that if one exists(minus special case of |
2 things I noticed, neither of which are deal breakers:
|
|
Fixed the incorrect sorting and pinned @HubSpot and @marketplace folders to top of the list |
@anthmatic I filed an issue for the filemapper endpoint to include the |
packages/cms-cli/commands/ls.js
Outdated
return fileOrFolder; | ||
} | ||
|
||
return `/${fileOrFolder}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason for prepending /
to some items but not others? If we decide to keep this logic, one thing to keep in mind is that modules also have a postfix (e.g. .module
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done to make it clearer which items are folders(prepended with /
) and which are files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't mymodule.module
a folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should borrow from |
packages/cms-cli/commands/list.js
Outdated
mappedContents | ||
.sort(function(a, b) { | ||
// Pin @hubspot folder to top | ||
if (a === hubspotFolder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the other changes, does this still work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it looks to be pinning these folders to the top.
Note: The BE is not currently returning the @hubspot
folder(I've filed an issue for this in the filemapper repo).
I tested with the following code...
contentsResp = await getDirectoryContentsByPath(portalId, directoryPath);
const randomIndex = Math.floor(
Math.random() * contentsResp.children.length
);
contentsResp.children.splice(randomIndex, 0, '@hubspot');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were you testing with a root directory that had folders starting with numbers such as 1folder
?
Updated output to use Another potential that I looked into was using sprintf to create columns and having a column after the folder name indicating I believe that using color to distinguish folders is the simplest and clearest solution and is less confusing than |
We are using |
Description and Context
New command
hs list [path]
allows listing directory contents by path. Default path is root. Aliased ashs ls [path]
.Screenshots
Questions
Do we want to group folders/files and output folders first(perhaps withDone/
prefix)?Any other changes to the output(I made this as MVP as possible for now)?
Do we want to look at the BE endpoint to increase speed(it's a bit slow ATM)?
TODO
Filed issue with fileMapper to include
@hubspot
folder in list of contents returned from endpoint.Who to Notify
/cc @TheWebTech