Skip to content

Structural Project Overview

Thorsten de Buhr edited this page Jul 4, 2023 · 8 revisions

The whole cpackget is built around the cobra module command line parser. After setup, cobra module knows the functions to call after a command has been parsed. The cobra command setup can be found in the cmd/commands/ folder, e.g. add.go, init.go, rm.go.

Init Project, Command Line

flowchart LR
    A[main] --> I[Go Init functions]
    I --> I1[Sub command options<br>into corresponding structures<br>for cobra.Command]
    I --> I2[Modules]
    A --> B[Cobra<br>commands.NewCli]
    A --> C[Cobra<br>cmd.Execute]

    B --> D[Set up<br>general commands/options]
    B --> E[Set up<br>sub commands]

    E --> F[Commands with own options:<br>PackCmd<br>PdscCmd<br>IndexCmd<br>InitCmd<br>AddCmd<br>RmCmd<br>ListCmd<br>UpdateIndexCmd<br>ChecksumCreateCmd<br>ChecksumVerifyCmd<br>	SignatureCreateCmd<br>SignatureVerifyCmd]

    D --> G[General commands/options:<br>version<br>quiet<br>verbose<br>pack-root<br>concurrent-downloads<br>timeout<br>]

Loading

Execute Command Line

flowchart LR
    A[main] --> B[Cobra<br>commands.NewCli]
    A --> C[Cobra<br>cmd.Execute]
    C --> D[Cobra module<br>Execute]
    D --> E[Before executing command<br>PersistentPreRunE: configureInstaller]
    D --> F[Executes command: RunE: func]
    F --> G[Lambda function inside module,<br>e.g. add command]

Loading

Clone this wiki locally