Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ensure that network is set on install #43

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}