refactor(blockchain): qualify chain command examples

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Virgil 2026-04-04 09:54:42 +00:00
parent 6235fe5bd0
commit 2fd4a13526
4 changed files with 10 additions and 10 deletions

View file

@ -39,7 +39,7 @@ func AddChainCommands(root *cobra.Command) {
Use: "chain",
Short: "Manage the Lethean blockchain node",
Long: "Manage the Lethean blockchain node: sync and explore.",
Example: "chain explorer --data-dir ~/.lethean/chain\nchain sync --daemon\nchain sync --stop",
Example: "core-chain chain explorer --data-dir ~/.lethean/chain\ncore-chain chain sync --daemon\ncore-chain chain sync --stop",
}
chainCmd.PersistentFlags().StringVar(&dataDir, "data-dir", defaultChainDataDirPath(), "blockchain data directory")

View file

@ -22,7 +22,7 @@ func TestAddChainCommands_Good_RegistersParent(t *testing.T) {
assert.Equal(t, "chain", chainCmd.Name())
assert.Equal(t, "Manage the Lethean blockchain node", chainCmd.Short)
assert.Equal(t, "Manage the Lethean blockchain node: sync and explore.", chainCmd.Long)
assert.Equal(t, "chain explorer --data-dir ~/.lethean/chain\nchain sync --daemon\nchain sync --stop", chainCmd.Example)
assert.Equal(t, "core-chain chain explorer --data-dir ~/.lethean/chain\ncore-chain chain sync --daemon\ncore-chain chain sync --stop", chainCmd.Example)
}
func TestAddChainCommands_Good_HasSubcommands(t *testing.T) {
@ -60,7 +60,7 @@ func TestNewChainExplorerCommand_Good_Metadata(t *testing.T) {
assert.Equal(t, "explorer", cmd.Use)
assert.Equal(t, "Inspect blocks in a terminal UI", cmd.Short)
assert.Equal(t, "Browse blocks and transactions in a terminal UI while the node syncs.", cmd.Long)
assert.Equal(t, "chain explorer --data-dir ~/.lethean/chain", cmd.Example)
assert.Equal(t, "core-chain chain explorer --data-dir ~/.lethean/chain", cmd.Example)
assert.Equal(t, "Chain Explorer", chainExplorerFrameTitle)
}
@ -74,5 +74,5 @@ func TestNewChainSyncCommand_Good_Metadata(t *testing.T) {
assert.Equal(t, "sync", cmd.Use)
assert.Equal(t, "Synchronise from P2P peers", cmd.Short)
assert.Equal(t, "Synchronise the blockchain from P2P peers in foreground or daemon mode.", cmd.Long)
assert.Equal(t, "chain sync\nchain sync --daemon\nchain sync --stop", cmd.Example)
assert.Equal(t, "core-chain chain sync\ncore-chain chain sync --daemon\ncore-chain chain sync --stop", cmd.Example)
}

View file

@ -29,7 +29,7 @@ const chainExplorerFrameTitle = "Chain Explorer"
//
// Example:
//
// chain explorer --data-dir ~/.lethean/chain
// core-chain chain explorer --data-dir ~/.lethean/chain
//
// Use it alongside `AddChainCommands` to expose the TUI node view.
func newChainExplorerCommand(dataDir, seed *string, testnet *bool) *cobra.Command {
@ -37,7 +37,7 @@ func newChainExplorerCommand(dataDir, seed *string, testnet *bool) *cobra.Comman
Use: "explorer",
Short: "Inspect blocks in a terminal UI",
Long: "Browse blocks and transactions in a terminal UI while the node syncs.",
Example: "chain explorer --data-dir ~/.lethean/chain",
Example: "core-chain chain explorer --data-dir ~/.lethean/chain",
RunE: func(cmd *cobra.Command, args []string) error {
return runChainExplorer(*dataDir, *seed, *testnet)
},

View file

@ -27,9 +27,9 @@ import (
//
// Example:
//
// chain sync
// chain sync --daemon
// chain sync --stop
// core-chain chain sync
// core-chain chain sync --daemon
// core-chain chain sync --stop
//
// It keeps the foreground and daemon modes behind a predictable command path.
func newChainSyncCommand(dataDir, seed *string, testnet *bool) *cobra.Command {
@ -42,7 +42,7 @@ func newChainSyncCommand(dataDir, seed *string, testnet *bool) *cobra.Command {
Use: "sync",
Short: "Synchronise from P2P peers",
Long: "Synchronise the blockchain from P2P peers in foreground or daemon mode.",
Example: "chain sync\nchain sync --daemon\nchain sync --stop",
Example: "core-chain chain sync\ncore-chain chain sync --daemon\ncore-chain chain sync --stop",
RunE: func(cmd *cobra.Command, args []string) error {
if stopDaemon {
return stopChainSyncDaemon(*dataDir)