shuichiro-makigaki / mendeley_cli

CLI for Mendeley
MIT License
4 stars 0 forks source link

Allowing output to be json #5

Closed A3EKV closed 2 years ago

A3EKV commented 2 years ago

The default output of mendeley get documents is missing a lot of properties returned by the API. Allowing output as json (for instance via an option --json) will be such a nice feature because we can pipe that to jq command and manipulate/filter the output as desired.

shuichiro-makigaki commented 2 years ago

--print-format option works at the newest version (v0.1.4). You can see supported formats by --help.

A3EKV commented 2 years ago

Thank you very much for response. I have tried that but I get the following error when I use for example json or html, I haven't tested the other formats yet:

mendeley get documents --print-format json | tee documents.json

-------------------------------------------------------------------------------
mendeley 8 <module>
sys.exit(cmd())

core.py 1137 __call__
return self.main(*args, **kwargs)

core.py 1062 main
rv = self.invoke(ctx)

core.py 1668 invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))

core.py 1668 invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))

core.py 1404 invoke
return ctx.invoke(self.callback, **ctx.params)

core.py 763 invoke
return __callback(*args, **kwargs)

__init__.py 222 cmd_get_documents
print_table(dataset, print_format)

__init__.py 91 print_table
print(dataset.export(fmt, tablefmt='simple'))

core.py 427 export
return fmt.export_set(self, **kwargs)

TypeError:
export_set() got an unexpected keyword argument 'tablefmt'
shuichiro-makigaki commented 2 years ago

It may be the old version. Could you update Mendeley CLI?