tenox7 / stc

Syncthing CLI Tool
Apache License 2.0
74 stars 9 forks source link

feat: add support for device/folder specific json output #5

Closed jackmac92 closed 2 months ago

jackmac92 commented 2 months ago

Added two new commands to get either device or folder info in json format, but it always prints in json. Is that ok with you?

Closes #4

tenox7 commented 2 months ago

I don't want to be picky and will accept as is. But consider having just one "jsonDump" function and then have devices and folders as nodes in the json?

jackmac92 commented 2 months ago

no problem can take a look tomorrow, wanted to send off the initial PR for feedback before I spent more time

thanks for starting this project, looks like it'll be helpful for me!

tenox7 commented 2 months ago

again thanks a lot!

please remind me to create a release if I don't do it in a day or two

tenox7 commented 2 months ago

also could you update readme? thanks

tenox7 commented 2 months ago

hey I ran it on a mac and getting this:

2024/09/21 12:14:19 apikey and target flags not specified, config file: stat /var/folders/mm/vms_5fl93xsdj9038v77jfx80000gn/T/go-build1836372428/b001/exe/config.xml: no such file or directory

this doesn't sound right?

jackmac92 commented 2 months ago

@tenox7 hmm no that doesn't seem correct, I've been running on ubuntu but have a mac machine I can test on and can do some more testing there I just did a quick test there of cloning the repo and running go run . json_dump w/in it, printed the expected json for me. Could you share the commands you used for testing to try to help me reproduce the issue?

jackmac92 commented 2 months ago

I think you're hitting that error here line 372 before it gets into the switch flag.Arg(0)

tenox7 commented 2 months ago

yeah, but since you're trying to find the config file, could you maybe add to the error that it's not specified and attempt to find automatically it also failed? :)

jackmac92 commented 2 months ago

Gotcha! I don't think I can expand the error message after a log.Fatal but can update the existing init on cfg, just need to look into how later

jackmac92 commented 2 months ago

I wasn't using any env vars/flags to set api auth, just relied on findCfgFile so I'm not sure how to make the error more helpful

tenox7 commented 2 months ago

no worries, I think I can add a better message then release it :)

jackmac92 commented 2 months ago

@tenox7 thanks for the error update and release!