send-to-workflowy icon indicating copy to clipboard operation
send-to-workflowy copied to clipboard

CLI question

Open cjlm opened this issue 3 years ago • 9 comments

I forgot to enable Issues on the repo so @markfirmware opened a PR with a question instead...

Does this include a cli that I can use to fetch wf data? If so, how is it installed and run? opusfluxus is not working for me - keeps asking for my email.

Yes, there is a CLI although I haven't documented it as it's not fully tested. I also found that opusfluxus wasn't working but I'm not clear how it's different from send-to-workflowy now. The CLI should work if you do the following in the base directory:

yarn
node wf-cli

It uses the same logic as opusfluxus to save your credentials to a file in your $HOME

Please note that I'll be moving it into it's own yarn workspace in the next release. It shouldn't be in the base directory like it is now.

Let me know how you get on @markfirmware!

cjlm avatar Sep 15 '21 23:09 cjlm

Actually, ignoring that error and entering my email, I get:

Login successful.
Failed to write sessionid to config

markfirmware avatar Sep 16 '21 00:09 markfirmware

Hmm, strange. I'll look into it.

What auth do you use with WF? Password? Multifactor? Email code?

cjlm avatar Sep 16 '21 01:09 cjlm

Looks like it's working correctly but is unable to save to HOME when using GitPod.

The initial error needs fixing though

cjlm avatar Sep 16 '21 01:09 cjlm

I'm not sure about the gitpod config bit but there was a pretty obvious mistake in the auth code. I've fixed it on the cli-fix branch for a future merge

cjlm avatar Sep 16 '21 19:09 cjlm

Thanks! I tried fix-cli:

What is your workflowy login info? This will not be saved, merely used once to authenticate.
✔ Email: …  #xxx@xxx
err TypeError: Cannot read property 'split' of null
at Object.parseCookies (/workspace/send-to-workflowy/utils.js:5:10)
at WorkflowyClient.login (/workspace/send-to-workflowy/index.js:68:31)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async auth (/workspace/send-to-workflowy/wf-cli.js:217:5)
at async initialize (/workspace/send-to-workflowy/wf-cli.js:17:5)
at async Command.<anonymous> (/workspace/send-to-workflowy/wf-cli.js:93:16)
at async Command.parseAsync (/workspace/send-to-workflowy/node_modules/commander/lib/command.js:871:5)
Login successful.

Since I only entered my email and not a password or the like, I think the successful message is not accurate.

markfirmware avatar Sep 16 '21 19:09 markfirmware

Argh. I've pushed a fix for the cookies thing too. It may work now but it's clear the error handling needs an overhaul.

cjlm avatar Sep 16 '21 19:09 cjlm

That appears to resolve it for me on gitpod:

gitpod /workspace/send-to-workflowy $ node wf-cli tree 1
⦿ fetching workflowy tree
No config detected... starting authentication process...
What is your workflowy login info? This will not be saved, merely used once to authenticate.
✔ Email: … <email>
✔ Password … ********************************************************
Login successful.
Your session id is: <sessionid>
Successfully wrote sessionid to /home/gitpod/.config/send-to-workflowy-nodejs/config.json

cjlm avatar Sep 17 '21 03:09 cjlm

I am still having trouble on gitpod. I will add a report later tonight.

markfirmware avatar Sep 17 '21 17:09 markfirmware

Any update @markfirmware?

cjlm avatar Oct 05 '21 23:10 cjlm