timwis / markdown-to-google-doc

Converts a markdown file to .docx and then imports it to Google Drive
189 stars 16 forks source link

illegal option -- - #3

Open MareoRaft opened 5 years ago

MareoRaft commented 5 years ago

Error importing file on macOS 10.14.1

~ % md2gd import "/Users/Matthew/Desktop/ar-frontend-design-choices.md"
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
--reference-docx has been removed. Use --reference-doc instead.
Try pandoc --help for more information.
md2gd: Conversion failed
rm: : No such file or directory
MareoRaft commented 5 years ago

changing --reference-docx to --reference-doc on line 7 of md2gd gets past that error and runs into the new error:

md2gdM import ~/Desktop/ar-frontend-design-choices.md
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
pandoc: : openBinaryFile: does not exist (No such file or directory)
md2gd: Conversion failed
rm: : No such file or directory
LRipi commented 4 years ago

Same problem here in MacOS 10.15.1

briantully commented 4 years ago

So the issue here is that the syntax for calling mktemp was updated recently, whereby the mktemp call is now using the --suffix option, which is not available in the version of mktemp bundled with OS X. To get around this error (and lots of other *nix -> osx issues) I recommend installing GNU core utilities via homebrew brew install coreutils https://formulae.brew.sh/formula/coreutils

By default, any GNU coreutils command that also exists in macosx will be prefixed with a "g", to get past the "illegal option" error in md2gd you'll need to update line 9 of md2gd and replace mktemp with gmktemp.

Note however, that due to issues withe the gdrive client ("Sign in with Google temporarily disabled for this app" - https://github.com/gdrive-org/gdrive/issues/533), I don't think you'll have success. What I wound up doing was commenting out the `rm "$temp_file" line, so that I could at least manually upload the converted docx file into Google Docs.