Add changeport command
Build Release Binaries / Build linux-arm64 (push) Successful in 14s
Build Release Binaries / Build linux-amd64 (push) Successful in 15s

This commit is contained in:
agosti_j committed 2026-08-24 13:43:17 +02:00
1 parent 9546159ff1
commit 445dd8638b
4 files changed
+69 -3

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
package command
func (i *Command) RunChangePort() error {
return i.runSteps(
i.CryosparcmChangePortStep(
i.cfg.HostName,
i.cfg.CryosparcPath,
i.cfg.BasePort,
portStart,
portEnd,
portCount,
i.cfg.CryosparcmHelp,
),
)
}
+2 -2
View File
@@ -10,8 +10,8 @@ import (
)
var (
portStart uint = 39400 // Start port range to assign new base port
portEnd uint = 40000 // End port range to assign new base port
portStart uint = 61000 // Start port range to assign new base port
portEnd uint = 62000 // End port range to assign new base port
portCount uint = 10 // Number of contiguous ports available
)
+27 -1
View File
@@ -76,7 +76,6 @@ func (i *Command) CryosparcmCreateUserStep(
Message: fmt.Sprintf("Creating CryoSPARC user (instance: %s)", cryosparcpath),
CompletedMessage: nil,
Condition: func() (bool, error) {
return true, nil
},
Prompt: func() *huh.Form {
@@ -163,6 +162,33 @@ func (i *Command) CryosparcmCreateUserStep(
}
}
func (i *Command) CryosparcmChangePortStep(
hostname,
cryosparcpath string,
port, start, end, count uint,
help bool) ui.Step {
return ui.Step{
Message: fmt.Sprintf("Changing base port (instance: %s)", cryosparcpath),
CompletedMessage: nil,
Exec: func() *exec.Cmd {
if port == 0 {
i.setCryosparcBasePort(hostname, start, end, count)
}
return cryosparcmCmd(
hostname,
cryosparcpath,
"",
help,
"changeport",
strconv.FormatUint(uint64(i.cfg.BasePort), 10),
)
},
}
}
// =============================================================================
// cryosparcm commands Steps
// =============================================================================