Skip to content

Commit

Permalink
feat: ensure that network is set on install (#43)
Browse files Browse the repository at this point in the history
Fixes #41
  • Loading branch information
agaffney authored Feb 25, 2024
1 parent 754b69a commit f19e6b8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/cardano-up/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ func installCommand() *cobra.Command {
}
}
}
// Check that context network is set
_, activeContext := pm.ActiveContext()
if activeContext.Network == "" {
slog.Error(
"no network specified for context, use -n/--network to specify a network",
)
os.Exit(1)
}
packages := pm.AvailablePackages()
foundPackage := false
for _, tmpPackage := range packages {
Expand All @@ -93,6 +101,6 @@ func installCommand() *cobra.Command {
slog.Info(fmt.Sprintf("Successfully installed package %s", args[0]))
},
}
installCmd.Flags().StringVarP(&installFlags.network, "network", "n", "preprod", "specifies network for package")
installCmd.Flags().StringVarP(&installFlags.network, "network", "n", "", "specifies network for package")
return installCmd
}

0 comments on commit f19e6b8

Please sign in to comment.