feat(xcecli): bare -I maps to TTY attach interactive mode

-I without --xjob now means -I --tty: the submit attaches the interactive
session right in the calling terminal through the apiserver relay. The
previous bare -I mapping (interactive=3, readonly DISPLAY web view) had no
interactive input and gave the user no hint; --browse still opens the web
URL for TTY jobs and --xjob keeps the VNC path. The API's interactive=3
semantics are unchanged -- only this CLI's default remaps.

Help text updated: -I/--tty/--xjob descriptions and the long-help examples.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
lei.chen 2026-10-15 03:40:32 +00:00
parent 6d5281daf1
commit 601f04dc00

View file

@ -91,6 +91,14 @@ func (js *JobSubmitter) ParseCmdArgs(cmd *cobra.Command, args []string) error {
if js.useTTY && js.useXJob {
return fmt.Errorf("error: cannot use both --tty and --xjob")
}
// Bare -I is the attach interactive session: -I without --xjob is
// equivalent to -I --tty. The old mapping (interactive=3, readonly
// DISPLAY web view) had no interactive input and no user hint; the
// API's interactive=3 semantics are unchanged -- only this CLI's
// default remaps to TTY attach (use --xjob for VNC).
if !js.useXJob {
js.useTTY = true
}
}
// check if there is standard input redirection
@ -691,9 +699,10 @@ Example:
xce jobs submit -P project_name sleep 10 # submit job with project name
xce jobs submit --configfile job.xce # submit job using parameters from a configuration file
xce jobs submit -m "host1 host2" sleep 10 # submit job into host1 host2
xce jobs submit -I sleep 10 # submit interactive job and attach in this terminal (same as -I --tty)
xce jobs submit -I --tty sleep 10 # submit interactive job with tty and attach in this terminal
xce jobs submit -I --tty --browse sleep 10 # submit interactive tty job, open the web URL in a browser
xce jobs submit -I --xjob sleep 10 # submit interactive job with xjob
xce jobs submit -I --xjob sleep 10 # submit interactive job with xjob (VNC)
xce jobs submit -J 'name[1-N]' sleep 10 # submit a job array of N elements named "name"
xce jobs submit -J 'name[1]' sleep 10 # submit a job array of one element
@ -758,9 +767,9 @@ Job arrays:
flags.StringVarP(&jobSubmitter.outdir, "outdir", "d", "", "specify the output directory")
flags.StringVarP(&jobSubmitter.projectName, "project_name", "P", "", "specify the project name")
flags.StringVar(&jobSubmitter.configFile, "configfile", "", "specify the configuration file for job submission")
flags.BoolVarP(&jobSubmitter.interactive, "interactive", "I", false, "submit interactive job")
flags.BoolVar(&jobSubmitter.useTTY, "tty", false, "use TTY for interactive job (attach in this terminal after dispatch; --browse opens the web URL instead)")
flags.BoolVar(&jobSubmitter.useXJob, "xjob", false, "use XJob for interactive job")
flags.BoolVarP(&jobSubmitter.interactive, "interactive", "I", false, "submit interactive job (attach in this terminal; same as -I --tty; add --xjob for VNC)")
flags.BoolVar(&jobSubmitter.useTTY, "tty", false, "use TTY for interactive job (attach in this terminal after dispatch; --browse opens the web URL instead; default for -I)")
flags.BoolVar(&jobSubmitter.useXJob, "xjob", false, "use XJob (VNC) for interactive job")
flags.BoolVar(&jobSubmitter.useBrowse, "browse", false, "open the interactive session URL in a browser instead of attaching (TTY jobs attach by default)")
flags.StringVarP(&jobSubmitter.askedHosts, "m", "m", "", "specify the running hosts, with space for multiple values")
flags.StringVarP(&jobSubmitter.launchType, "launch_type", "", "", "specify the launch type")