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

Import all Markdown files in a directory #32

Closed
davidak opened this issue Mar 21, 2020 · 1 comment
Closed

Import all Markdown files in a directory #32

davidak opened this issue Mar 21, 2020 · 1 comment

Comments

@davidak
Copy link

@davidak davidak commented Mar 21, 2020

This should work:

codimd import /path/to/markdown/files

Workaround

[davidak@X230:~/code/cli/bin]$ for file in ~/Downloads/hackmd/*.md; do xdg-open $(CODIMD_SERVER='https://pad.nixnet.services' ./codimd import "$file" | awk '{print $4}'); done

(You have to open the imported note for it to appear in the history.)

@pirate

This comment has been minimized.

Copy link
Member

@pirate pirate commented Mar 24, 2020

I don't think this is worth implementing tbh, the bash loop is simple enough, and auto-importing directories is not a behavior that's expected for everyone. e.g if I mistype a path and forget the ending, I don't want it attempting to import every entry in a directory that potentially has thousands of random files in it. Also what if the user wants to import text files that don't end in .md? What about files that start with .? What if there are a mix of files in the directory (e.g. .DS_Store and others the user might not even know about), should we import only the ones that look like markdown and ignore the others? There are lots of edge-cases that make it less intuitive for the average use-case, I think it's safer to force the user to be explicit.

export CODIMD_SERVER='https://pad.nixnet.services'
for file in ~/Downloads/hackmd/*.md
	./codimd import "$file" >> note_urls.txt
done

The URL output will also be fixed by #31, making the xdg-open + awk workaround in your example snippet unnecessary.

@pirate pirate closed this Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.