Skip to content

Commit

Permalink
chore: update command descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
PhearZero committed Jan 3, 2025
1 parent cdf3d45 commit c56b34d
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 30 deletions.
7 changes: 3 additions & 4 deletions cmd/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (
"time"
)

var bootstrapCmdShort = "Initialize a fresh node. Alias for install, catchup, and start."
// bootstrapCmdShort provides a brief description of the "bootstrap" command to initialize a fresh Algorand node.
var bootstrapCmdShort = "Initialize a fresh node"

// cmdLong provides a detailed description of the Fast-Catchup feature, explaining its purpose and expected sync durations.
// bootstrapCmdLong provides a detailed description of the "bootstrap" command, including its purpose and functionality.
var bootstrapCmdLong = lipgloss.JoinVertical(
lipgloss.Left,
style.BANNER,
Expand All @@ -41,8 +42,6 @@ var tutorial = `# Welcome!
This is the beginning of your adventure into running the an Algorand node!
Morbi mauris quam, ornare ac commodo et, posuere id sem. Nulla id condimentum mauris. In vehicula sit amet libero vitae interdum. Nullam ac massa in erat volutpat sodales. Integer imperdiet enim cursus, ullamcorper tortor vel, imperdiet diam. Maecenas viverra ex iaculis, vehicula ligula quis, cursus lorem. Mauris nec nunc feugiat tortor sollicitudin porta ac quis turpis. Nam auctor hendrerit metus et pharetra.
`

// bootstrapCmd defines the "debug" command used to display diagnostic information for developers, including debug data.
Expand Down
3 changes: 0 additions & 3 deletions cmd/catchup/catchup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ var (
// defaultLag represents the default minimum catchup delay in milliseconds for the Fast Catchup process.
defaultLag int = 30_000

// force indicates whether to bypass certain checks or enforcement logic within a function or command execution flow.
force bool = false

// cmdLong provides a detailed description of the Fast-Catchup feature, explaining its purpose and expected sync durations.
cmdLong = lipgloss.JoinVertical(
lipgloss.Left,
Expand Down
3 changes: 3 additions & 0 deletions cmd/catchup/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ type DebugInfo struct {
Catchpoint `json:"catchpoint"`
}

// debugCmdShort provides a concise description for the debug command, indicating it displays debug information for Fast-Catchup.
var debugCmdShort = "Display debug information for Fast-Catchup."

// debugCmdLong provides a detailed description for the debug command, focusing on debugging fast-catchup issues.
var debugCmdLong = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
Expand Down
5 changes: 1 addition & 4 deletions cmd/catchup/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/spf13/cobra"
)

// startCmdLong provides a detailed description and overview message for the 'start' command, including notes and caveats.
var startCmdLong = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
Expand Down Expand Up @@ -60,7 +61,3 @@ var startCmd = utils.WithAlgodFlags(&cobra.Command{
log.Info(style.Green.Render(res))
},
}, &dataDir)

func init() {
startCmd.Flags().BoolVarP(&force, "force", "f", false, style.Yellow.Render("forcefully catchup the node"))
}
7 changes: 3 additions & 4 deletions cmd/catchup/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import (
"github.com/spf13/cobra"
)

// stopCmdShort provides a concise description of the "stop" command.
var stopCmdShort = "Stop a fast catchup"

// stopCmdLong provides a detailed description for the "stop" command including its functionality and important notes.
var stopCmdLong = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
Expand Down Expand Up @@ -50,7 +53,3 @@ var stopCmd = utils.WithAlgodFlags(&cobra.Command{

},
}, &dataDir)

func init() {
stopCmd.Flags().BoolVarP(&force, "force", "f", false, style.Yellow.Render("forcefully catchup the node"))
}
5 changes: 4 additions & 1 deletion cmd/configure/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import (
"github.com/spf13/cobra"
)

var short = "Configure the Algorand daemon."
// short holds a brief description of the system settings configuration command, currently marked as work in progress.
var short = "Change settings on the system (WIP)"

// long combines styled strings and descriptions for the detailed command overview displayed in the CLI.
var long = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
Expand Down
5 changes: 5 additions & 0 deletions cmd/configure/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (
"github.com/spf13/cobra"
)

// serviceShort provides a brief description of the service command, emphasizing its role in installing service files.
var serviceShort = "Install service files for the Algorand daemon."

// serviceLong provides a detailed description of the service command, its purpose, and an experimental warning note.
var serviceLong = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
Expand All @@ -22,6 +25,8 @@ var serviceLong = lipgloss.JoinVertical(
"",
style.Yellow.Render(explanations.ExperimentalWarning),
)

// serviceCmd is a Cobra command for managing Algorand service files, requiring root privileges to ensure proper execution.
var serviceCmd = &cobra.Command{
Use: "service",
Short: serviceShort,
Expand Down
21 changes: 19 additions & 2 deletions cmd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/algorandfoundation/algorun-tui/internal/algod/utils"
"github.com/algorandfoundation/algorun-tui/internal/system"
"github.com/algorandfoundation/algorun-tui/ui/style"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log"
"github.com/spf13/cobra"
"os/exec"
Expand Down Expand Up @@ -36,11 +37,27 @@ type DebugInfo struct {
DataFolder utils.DataFolderConfig `json:"data"`
}

// debugCmdShort provides a brief description of the "debug" command, which displays debugging information.
var debugCmdShort = "Display debugging information"

// debugCmdLong provides a detailed description of the "debug" command, outlining its purpose and functionality.
var debugCmdLong = lipgloss.JoinVertical(
lipgloss.Left,
style.BANNER,
"",
style.Bold(debugCmdShort),
"",
style.BoldUnderline("Overview:"),
"Prints the known state of the nodekit",
"Checks various paths and configurations to present useful information for bug reports.",
"",
)

// debugCmd defines the "debug" command used to display diagnostic information for developers, including debug data.
var debugCmd = cmdutils.WithAlgodFlags(&cobra.Command{
Use: "debug",
Short: "Display debug information for developers",
Long: "Prints debug data to be copy and pasted to a bug report.",
Short: debugCmdShort,
Long: debugCmdLong,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
log.Info("Collecting debug information...")
Expand Down
18 changes: 14 additions & 4 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/algorandfoundation/algorun-tui/cmd/utils/explanations"
"github.com/algorandfoundation/algorun-tui/internal/algod"
"github.com/algorandfoundation/algorun-tui/ui/style"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log"
"github.com/spf13/cobra"
"os"
Expand All @@ -16,15 +17,24 @@ const InstallMsg = "Installing Algorand"
// InstallExistsMsg is a constant string used to indicate that the Algod is already installed on the system.
const InstallExistsMsg = "algod is already installed"

var installShort = "Install the algorand daemon"
var installShort = "Install the node daemon"

var installLong = style.Purple(style.BANNER) + "\n" + style.LightBlue("Install the algorand daemon on your local machine")
var installLong = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
"",
style.Bold(installShort),
"",
style.BoldUnderline("Overview:"),
"Configures the local package manager and installs the algorand daemon on your local machine",
"",
)

// installCmd is a Cobra command that installs the Algorand daemon on the local machine, ensuring the service is operational.
var installCmd = &cobra.Command{
Use: "install",
Short: "Install the algorand daemon",
Long: style.Purple(style.BANNER) + "\n" + style.LightBlue("Install the algorand daemon on your local machine"),
Short: installShort,
Long: installLong,
SilenceUsage: true,
Run: func(cmd *cobra.Command, args []string) {
// TODO: yes flag
Expand Down
19 changes: 17 additions & 2 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,30 @@ import (
"github.com/algorandfoundation/algorun-tui/cmd/utils/explanations"
"github.com/algorandfoundation/algorun-tui/internal/algod"
"github.com/algorandfoundation/algorun-tui/ui/style"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log"
"github.com/spf13/cobra"
)

var startShort = "Start the node daemon"

var startLong = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
"",
style.Bold(startShort),
"",
style.BoldUnderline("Overview:"),
"Start the Algorand daemon on your local machine if it is not already running. Optionally, the daemon can be forcefully started.",
"",
style.Yellow.Render("This requires the daemon to be installed on your system."),
)

// startCmd is a Cobra command used to start the Algod service on the system, ensuring necessary checks are performed beforehand.
var startCmd = &cobra.Command{
Use: "start",
Short: "Start Algod",
Long: "Start Algod on your system (the one on your PATH).",
Short: startShort,
Long: startLong,
SilenceUsage: true,
PersistentPreRun: NeedsToBeStopped,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
18 changes: 16 additions & 2 deletions cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/algorandfoundation/algorun-tui/cmd/utils/explanations"
"github.com/algorandfoundation/algorun-tui/internal/algod"
"github.com/algorandfoundation/algorun-tui/ui/style"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log"
"time"

Expand All @@ -21,10 +22,23 @@ const StopSuccessMsg = "Algorand stopped successfully 🎉"
// StopFailureMsg is a constant string used as an error message when the Algod process fails to stop.
const StopFailureMsg = "failed to stop Algod"

var stopShort = "Stop the node daemon"

var stopLong = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
"",
style.Bold(stopShort),
"",
style.BoldUnderline("Overview:"),
"Stops the Algorand daemon on your local machine. Optionally, the daemon can be forcefully stopped.",
"",
style.Yellow.Render("This requires the daemon to be installed on your system."),
)
var stopCmd = &cobra.Command{
Use: "stop",
Short: "Stop Algod",
Long: "Stop the Algod process on your system.",
Short: stopShort,
Long: stopLong,
SilenceUsage: true,
PersistentPreRun: NeedsToBeRunning,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
19 changes: 17 additions & 2 deletions cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,33 @@ package cmd
import (
"github.com/algorandfoundation/algorun-tui/internal/algod"
"github.com/algorandfoundation/algorun-tui/ui/style"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log"
"github.com/spf13/cobra"
)

// UninstallWarningMsg provides a warning message to inform users they may be prompted for their password during uninstallation.
const UninstallWarningMsg = "(You may be prompted for your password to uninstall)"

var uninstallShort = "Uninstall the node daemon"

var uninstallLong = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
"",
style.Bold(uninstallShort),
"",
style.BoldUnderline("Overview:"),
"Uninstall Algorand node (Algod) and other binaries on your system installed by this tool.",
"",
style.Yellow.Render("This requires the daemon to be installed on your system."),
)

// uninstallCmd defines a Cobra command used to uninstall the Algorand node (Algod) and related binaries from the system.
var uninstallCmd = &cobra.Command{
Use: "uninstall",
Short: "Uninstall Algorand node (Algod)",
Long: "Uninstall Algorand node (Algod) and other binaries on your system installed by this tool.",
Short: uninstallShort,
Long: uninstallLong,
SilenceUsage: true,
PersistentPreRun: NeedsToBeStopped,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
19 changes: 17 additions & 2 deletions cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/algorandfoundation/algorun-tui/cmd/utils/explanations"
"github.com/algorandfoundation/algorun-tui/internal/algod"
"github.com/algorandfoundation/algorun-tui/ui/style"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log"
"github.com/spf13/cobra"
"os"
Expand All @@ -13,11 +14,25 @@ import (
// UpgradeMsg is a constant string used to indicate the start of the Algod upgrade process.
const UpgradeMsg = "Upgrading Algod"

var upgradeShort = "Upgrade the node daemon"

var upgradeLong = lipgloss.JoinVertical(
lipgloss.Left,
style.Purple(style.BANNER),
"",
style.Bold(upgradeShort),
"",
style.BoldUnderline("Overview:"),
"Upgrade Algorand packages if it was installed with package manager.",
"",
style.Yellow.Render("This requires the daemon to be installed on your system."),
)

// upgradeCmd is a Cobra command used to upgrade Algod, utilizing the OS-specific package manager if applicable.
var upgradeCmd = &cobra.Command{
Use: "upgrade",
Short: "Upgrade Algod",
Long: "Upgrade Algod (if installed with package manager).",
Short: upgradeShort,
Long: upgradeLong,
SilenceUsage: true,
PersistentPreRun: NeedsToBeStopped,
Run: func(cmd *cobra.Command, args []string) {
Expand Down

0 comments on commit c56b34d

Please sign in to comment.