ngs icon indicating copy to clipboard operation
ngs copied to clipboard

jc integration - suggest to install

Open ilyash-b opened this issue 3 years ago • 2 comments

NGS should recommend to install jc when NGS is unable parse the output of a command or a contents of a file.

Parsing a command

data = ``some_command``

If the above fails, the recommendation should say something like "please install jc and run as following:"

data = ``jc some_command``

Parsing a file

Example:

data = fetch('/etc/fstab')

Same for the above except no code modification is required, just re-run when jc is installed.

Useful information

Baking the list of supported commands into NGS

  • jc -a outputs a list of supported commands and platforms
  • The platform roughly corresponds to sys.platform in Python
  • Beware of two_word_command - a command with an argument, for example airport -s
  • jc -a apparently does not have paths of supported files (like /etc/fstab) except for in description

ilyash-b avatar Jan 24 '22 07:01 ilyash-b

Have second thoughts regarding the exact behavior of fetch(). It is asymmetrical with the run-and-parse syntax. The issue here is if at any point in time, NGS will consider a particular file or two so important as to have built-in parser in NGS, there would be a conflict.

ilyash-b avatar Jan 24 '22 07:01 ilyash-b

TODO: also handle the situation with run-and-parse when jc is installed but was not used

ilyash-b avatar Jan 24 '22 09:01 ilyash-b