Skip to content
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

Suggestion: Pass directory and possibly with a recursive option #28

Open
ClydeDz opened this issue Jun 4, 2019 · 7 comments
Open

Suggestion: Pass directory and possibly with a recursive option #28

ClydeDz opened this issue Jun 4, 2019 · 7 comments
Assignees

Comments

@ClydeDz
Copy link

ClydeDz commented Jun 4, 2019

Currently, I've written a PowerShell script to loop thru all markdown files in a directory and sub-directories and then pass the list of files. Would be great to have a built in option to do this instead.

P.S. I've tried the command ./node_modules/.bin/m2j -o index.json ./mddata/*.md but I get this error: Error: ENOENT: no such file or directory, lstat './mddata/*.md'.

@scottstanfield
Copy link
Owner

Hmm. This looks like a glob star expansion issue on Windows. I have a Parallels VM with Windows on it that I can test on. Adding this to the stack of issues to fix.

@scottstanfield scottstanfield self-assigned this Jan 3, 2020
@go-diego
Copy link

On Windows, if you have Git Bash, you can run something like ./node_modules/.bin/m2j -o index.json ./mddata/*.md just fine

@scottstanfield
Copy link
Owner

That seems like a solid work-around. Can you test with WSL as well on Windows? Then I can close this issue.

@go-diego
Copy link

Here is what I found:

Assuming you have defined an npm script like this:

 "scripts": {
    "start": "node_modules/.bin/m2j -p -c -o output.json ./input/*.md"
  }

Opening a git bash terminal (or setting it up as the integrated terminal on vs code) and running npm start will not work and will throw the error the OP reports.

However, if in the git bash terminal you run node_modules/.bin/m2j -p -c -o output.json ./input/*.md, this will work.

With WSL, both npm start and node_modules/.bin/m2j -p -c -o output.json ./input/*.md will work.

Note: With WSL, as a first time user just for this test, I had to solve a path issue and install npm and nodejs again on my Linux distro.

@scottstanfield
Copy link
Owner

Suggestion for now: rather than add a recursive feature, do that in the outer controlling shell either with setopt -s extglob and maybe with GNU parallel.

Try:

shopt -s extglob
ls **/*.sh

Will recursively list all the *.sh files under your path. Just a thought. Still leaving this open until a workaround.

@ph1-xyz
Copy link

ph1-xyz commented Mar 15, 2020

Hi! I'm seeking too to have nested jsons, based on the folder structure on which I'm using m2a. Can you suggest me a way to achieve this?

@go-diego
Copy link

@ph1-xyz The solution above did not work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants