CLI: `--analyze` for a sibling folder produces odd paths in output
kachkaev opened this issue ยท comments
Hi again @Nixinova ๐
Just wanted to share a small observation, which should be a rather rare use case. Iโve got two folders, say my-analytics-tool
and my-analytics-tool-data
. The first folder contains uses linguist-cli
as a dependency, while the second folder contains a repo I want to analyse.
Here is what I do:
cd /path/to/my-analytics-tool
yarn add linguist-js
yarn linguist --analyze ../my-analytics-tool-data --json
And here is what shows up in the output:
{
"files": {
"count": 2,
"bytes": 0,
"results": {
".-data/README.md": "Markdown",
".-data/example.js": "JavaScript"
}
},
"languages": {
"count": 2,
"bytes": 0,
"results": {
"Markdown": { "type": "prose", "bytes": 0, "color": "#083fa1" },
"JavaScript": { "type": "programming", "bytes": 0, "color": "#f1e05a" }
}
},
"unknown": {
"count": 0,
"bytes": 0,
"extensions": {},
"filenames": {}
}
}
As you can see, instead of proper relative or absolute paths, the output includes entries like ".-data/README.md"
. Perhaps, showing full paths would be the right thing to do given what the JS-imported version does. That would be:
{
"files": {
"results": {
"/path/to/my-analytics-tool-data/README.md": "Markdown",
"/path/to/my-analytics-tool-data/example.js": "JavaScript"
}
}
I guess there could also be an option to render file paths relative to some specific root path.
Perhaps, showing full paths would be the right thing to do given what the JS-imported version does.
The latest commit should have done that: a01a3ed, it just hasn't been published to npm yet. From the next version all --json
output filenames will be absolute.
That's cool, thanks! Happy to test that out when a new version is published ๐ The diff looks promising ๐
Try it now with v2.0.1.
Yep, it works ๐ Thanks for your quick response ๐ฏ