chtg-cli

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package main provides the main entry point for the CLI application.

The main function parses the command line arguments, creates a graph of tables, and saves it to the specified output file or outputs it to the console depending on the specified options:

  • --clickhouse-host string - Clickhouse host to get tables from. Optional. Default value is "localhost"
  • --clickhouse-port string - Clickhouse port. Optional. Default value 9000
  • --clickhouse-table string - Clickhouse full table name in format <database>.<table> to get dependencies for. Required.
  • --clickhouse-user string - Clickhouse username. Optional. Default value is "" (empty string)
  • --out-file string - Output file name. Optional. If not specified, the output will be printed to the console.
  • --out-format string - Output format. Default value "mermaid-html". Possible values: "mermaid-html", "mermaid-md".
  • --mermaid-theme - Mermaid theme. Optional. Default value is 'default'. See https://mermaid-js.github.io/mermaid/#/theming
  • --table-highlight-color - Highlight color for the selected clickhouse table. E.g. '#ff5757' or 'red' Optional. If not specified, the table will not be highlighted. See https://mermaid.js.org/syntax/flowchart.html?id=flowcharts-basic-syntax#styling-a-node

Note: The command will ask for the ClickHouse password for the specified user.

For example command:

go run . --clickhouse-host=localhost --clickhouse-port=9000 --clickhouse-user=test_user --clickhouse-table=test_db.test_table --out-format=mermaid-html --out-file=output.html

will do the following:

  1. ask for ClickHouse password for the clickhouse server on localhost:9000;
  2. connect to the ClickHouse server on localhost:9000 with the test_user and the provided password;
  3. fetch the list of all tables (which can be accessed by the user) from the system.tables;
  4. create a graph of tables connected to the specified table test_db.test_table;
  5. export graph to the mermaid html format;
  6. save the exported mermaid html to output.html file;

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL