mirror of
https://github.com/luxfi/cli.git
synced 2026-10-30 17:01:20 +00:00
- Update github.com/luxfi/netrunner v1.15.3 → v1.15.4 - Update github.com/luxfi/node v1.22.77 → v1.22.80 - Remove local replace directive for netrunner - Use published package versions for reproducible builds
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
// Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package upgradecmd
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
|
|
"github.com/luxfi/cli/pkg/cobrautils"
|
|
"github.com/luxfi/cli/pkg/ux"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// lux blockchain upgrade print
|
|
func newUpgradePrintCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "print [blockchainName]",
|
|
Short: "Print the upgrade.json file content",
|
|
Long: `Print the upgrade.json file content`,
|
|
RunE: upgradePrintCmd,
|
|
Args: cobrautils.ExactArgs(1),
|
|
}
|
|
|
|
return cmd
|
|
}
|
|
|
|
func upgradePrintCmd(_ *cobra.Command, args []string) error {
|
|
blockchainName := args[0]
|
|
if !app.GenesisExists(blockchainName) {
|
|
ux.Logger.PrintToUser("The provided blockchain name %q does not exist", blockchainName)
|
|
return nil
|
|
}
|
|
|
|
fileBytes, err := app.ReadUpgradeFile(blockchainName)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
var prettyJSON bytes.Buffer
|
|
if err = json.Indent(&prettyJSON, fileBytes, "", " "); err != nil {
|
|
return err
|
|
}
|
|
ux.Logger.PrintToUser("%s", prettyJSON.String())
|
|
return nil
|
|
}
|