Skip to content

hide global flags under options#168

Merged
yevgenypats merged 5 commits intomainfrom
feat/hide_global_flags
Aug 7, 2021
Merged

hide global flags under options#168
yevgenypats merged 5 commits intomainfrom
feat/hide_global_flags

Conversation

@yevgenypats
Copy link
Copy Markdown
Contributor

@yevgenypats yevgenypats commented Aug 7, 2021

Currently all global flags that are rarely used are being printed to the screen on every help command which makes it very hard to read the relevant commands.

This PR hides the global flags in all commands help messages and they can be viewed by using cloudquery options. Very similar idea is used in kubectl options for the same purposes.

% cloudquery options

The following are global options and can be passed to any commands

Global Flags:
      --config string               path to configuration file. can be generated with 'gen config' command (env: CQ_CONFIG_PATH) (default "./config.hcl")
      --dsn string                  database connection string (env: CQ_DSN) (example: 'host=localhost user=postgres password=pass DB.name=postgres port=5432')
      --enable-console-log          Enable console logging
      --enable-file-logging         enableFileLogging makes the framework logging to a file (default true)
      --encode-json                 EncodeLogsAsJson makes the logging framework logging JSON instead of KV
      --log-directory string        Directory to logging to to when file logging is enabled (default ".")
      --log-file string             Filename is the name of the logfile which will be placed inside the directory (default "cloudquery.log")
      --max-age int                 MaxAge the max age in days to keep a logfile (default 3)
      --max-backups int             MaxBackups the max number of rolled files to keep (default 3)
      --max-size int                MaxSize the max size in MB of the logfile before it's rolled (default 30)
      --no-verify                   NoVerify is true registry won't verify the plugins
      --plugin-dir string           Directory to save and load CloudQuery plugins from (env: CQ_PLUGIN_DIR) (default "./.cq/providers")
      --policy-dir string           Directory to save and load CloudQuery policies from (env: CQ_POLICY_DIR) (default "./.cq/policies")
      --reattach-providers string   Path to reattach unmanaged plugins, mostly used for testing purposes (env: CQ_REATTACH_PROVIDERS)
      --skip-build-tables           Skip building tables on run, this should only be true if tables already exist.
  -v, --verbose                     Enable Verbose logging

This hides global flags in all commands and can be show by using cloudquery options. This is very similar to kubectl options design.

The new top-level help is now nice and clean:

CloudQuery CLI

Query your cloud assets & configuration with SQL for monitoring security, compliance & cost purposes.

Find more information at:
        https://docs.cloudquery.io

Usage:
cloudquery [command]

Available Commands:
completion  Generate completion script (run --help for full instructions)
fetch       Fetch resources from configured providers
init        Generate initial config.hcl for fetch command
options     Prints list of global CLI options (applies to all commands)
policy      Download and run CloudQuery policy
version     Print full version info of cloudquery

Additional help topics:

Use "cloudquery [command] --help" for more information about a command.
Use "cloudquery options" for a list of global CLI options.

@yevgenypats yevgenypats requested a review from roneli August 7, 2021 08:59
@yevgenypats yevgenypats force-pushed the feat/hide_global_flags branch 4 times, most recently from 9e9ca2d to bf1d43c Compare August 7, 2021 15:05
@yevgenypats yevgenypats force-pushed the feat/hide_global_flags branch from bf1d43c to 3b1d456 Compare August 7, 2021 15:31
Copy link
Copy Markdown
Contributor

@roneli roneli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, we should get the tests working, it seems like it prints the console info in a terminal situation which is weird

@yevgenypats yevgenypats merged commit 93d139f into main Aug 7, 2021
@yevgenypats yevgenypats deleted the feat/hide_global_flags branch August 7, 2021 18:58
@cq-bot cq-bot mentioned this pull request Aug 9, 2022
erezrokah pushed a commit that referenced this pull request Aug 14, 2022
🤖 I have created a release *beep* *boop*
---


## [0.5.16](cloudquery/cq-provider-digitalocean@v0.5.15...v0.5.16) (2022-06-27)


### Bug Fixes

* **deps:** fix(deps): Update module github.com/cloudquery/cq-provider-sdk to v0.12.5 ([#167](cloudquery/cq-provider-digitalocean#167)) ([5298f7d](cloudquery/cq-provider-digitalocean@5298f7d))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
erezrokah pushed a commit that referenced this pull request Aug 14, 2022
…13.5 (#168)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/cloudquery/cq-provider-sdk](https://togithub.com/cloudquery/cq-provider-sdk) | require | patch | `v0.13.4` -> `v0.13.5` |

---

### Release Notes

<details>
<summary>cloudquery/cq-provider-sdk</summary>

### [`v0.13.5`](https://togithub.com/cloudquery/cq-provider-sdk/releases/tag/v0.13.5)

[Compare Source](https://togithub.com/cloudquery/cq-provider-sdk/compare/v0.13.4...v0.13.5)

##### Bug Fixes

-   Optional forced search_path ([#&#8203;415](https://togithub.com/cloudquery/cq-provider-sdk/issues/415)) ([89d6b92](https://togithub.com/cloudquery/cq-provider-sdk/commit/89d6b923e0fa1f878eb7fee12336f2214f1d7ee5))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants