12 Commits
Author SHA1 Message Date
Vlad Klokun f005cb7f80 feat: always print to (T)UI using PrettyPrinter
Prior to this change, `pretty-printer` was a special type of Printer
that wrote output to `Stdout`, unless explicitly asked to write to a
given file. Kubescape used `pretty-printer` as an output format by
default. This behavior created the following inconsistencies:
- When invoked as `kubescape scan`, Kubescape would use `pretty-printer`
  by default, and it would output the scan resluts in the
  `pretty-printer` format to `Stdout`.
- When invoked as `kubescape scan --format=pretty-printer`, the behavior
  would be as above.
- When invoked as `kubescape scan --format=FORMAT`, where `FORMAT` is any
  format except for `pretty-printer`, Kubescape would write the results
  to a sensible default file for the selected format. This is in
  contrast to how `--format=pretty-printer` would still output to
  `os.Stdout`, and not an output file.
- When invoked as `kubescape scan --format=ANY_FORMAT --output=FILENAME`, where
  `ANY_FORMAT` is any format, including `pretty-printer`, Kubescape
  would write the results to the provided `FILENAME` in the given
  `ANY_FORMAT`, and not write any results to `Stdout`.

The aforementioned situation complicates life for users running
Kubescape in CI, where Kubescape would skip writing the results to
`Stdout` and only write to the provided output file.

Moreover, with the addition of support for multiple output formats and,
hence, files, this introduces the following ambiguity:
- When invoked as `kubescape scan --format=json,pdf,pretty-printer
  --output=FILENAME`, should Kubescape treat `pretty-printer` as a
  format for the output file, or just an instruction to also print the
  results to `Stdout`?

To fix these inconsistencies and ambiguities, this commit introduces the
following changes:

- Kubescape will always print results to `Stdout` using the
  PrettyPrinter format.

- The `--format` CLI flag will control the format(s) in which the results
  will be written to one or many *output* files. This breaks the
  previous behavior that running `kubescape scan
  --format=pretty-printer` would not produce an output file, and only
  write to `Stdout`. After this change, the same invocation will still
  write to `Stdout`, but also produce a `report.txt` file in the
  PrettyPrinter format.
2022-12-22 15:00:59 +02:00
Amir Malka bfbd278e7c commented out tests which made actual http calls 2022-10-25 18:26:07 +03:00
David Wertenteil bd970eff83 update to kubescape org 2022-08-22 18:22:28 +03:00
David Wertenteil ad91178ef7 updated dependencies pkgs 2022-08-18 17:41:03 +03:00
Vlad Klokun 2de950cce7 chore!: scaninfo_test.go: remove commented out code 2022-08-18 15:18:48 +03:00
David Wertenteil 9334ad6991 fixed typo 2022-06-19 14:11:04 +03:00
David Wertenteil 7b5e4143c3 fixed test for win 2022-06-19 12:47:42 +03:00
David Wertenteil e63e5502cd fixed test 2022-06-19 11:55:47 +03:00
David Wertenteil 536a94de45 adding git data to file 2022-06-08 16:26:02 +03:00
David Wertenteil 8a1ef7da87 submit git scanning 2022-06-07 17:39:02 +03:00
David Wertenteil 4ba33578ce sent git repo context 2022-04-13 15:31:48 +03:00
David Wertenteil 7d7336ae01 support only one input 2022-04-07 09:53:44 +03:00