Skip to content

Commit 8f11d2f

Browse files
committed
Rename OneOff to Run
1 parent 7fbdc58 commit 8f11d2f

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/cmd.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,8 +1146,8 @@ command!(
11461146
);
11471147

11481148
command!(
1149-
OneOff,
1150-
"one-off",
1149+
Run,
1150+
"run",
11511151
"exec specified command in a new container of the active pod",
11521152
|clap: App<'static, 'static>| clap.arg(
11531153
Arg::with_name("command")
@@ -1173,7 +1173,7 @@ command!(
11731173
.takes_value(true)
11741174
.min_values(0)
11751175
),
1176-
vec!["one-off"],
1176+
vec!["run"],
11771177
|args: Vec<&str>, env: &Env| if args.len() <= 1 {
11781178
let mut v = Vec::new();
11791179
let argstart = args.get(0);
@@ -1217,7 +1217,7 @@ command!(
12171217
c
12181218
}
12191219
_ => {
1220-
clickwrite!(writer, "Need an active pod to run one-off command.\n");
1220+
clickwrite!(writer, "Need an active pod to run an one-off command.\n");
12211221
return;
12221222
}
12231223
},
@@ -1239,7 +1239,7 @@ command!(
12391239
}
12401240
}
12411241
_ => {
1242-
clickwrite!(writer, "Need an active pod to run one-off command.\n");
1242+
clickwrite!(writer, "Need an active pod to run an one-off command.\n");
12431243
return;
12441244
}
12451245
},
@@ -1275,6 +1275,7 @@ command!(
12751275
clickwrite!(writer, "Couldon't get container image\n");
12761276
return;
12771277
};
1278+
let pod_name = format!("one-off-shell-{}", container_image.as_str());
12781279

12791280
if matches.is_present("terminal") {
12801281
let terminal = if let Some(t) = matches.value_of("terminal") {
@@ -1292,7 +1293,7 @@ command!(
12921293
"--context",
12931294
&kluster.name,
12941295
"run",
1295-
"one-off-shell",
1296+
pod_name.as_str(),
12961297
"--restart=Never",
12971298
"-i",
12981299
"--rm",
@@ -1311,14 +1312,14 @@ command!(
13111312
);
13121313
}
13131314
} else {
1314-
clickwrite!(writer, "Starting one-off container with image {:?}\n", container_image);
1315+
clickwrite!(writer, "Starting an one-off container with image {:?}\n", container_image);
13151316
let status = Command::new("kubectl")
13161317
.arg("--namespace")
13171318
.arg(ns)
13181319
.arg("--context")
13191320
.arg(&kluster.name)
13201321
.arg("run")
1321-
.arg("one-off-shell")
1322+
.arg(pod_name)
13221323
.arg("--restart=Never")
13231324
.arg("-i")
13241325
.arg("--rm")
@@ -1333,7 +1334,7 @@ command!(
13331334
}
13341335
}
13351336
} else {
1336-
clickwrite!(writer, "Need an active pod in order to run one-off command.\n");
1337+
clickwrite!(writer, "Need an active pod in order to run an one-off command.\n");
13371338
}
13381339
}
13391340
);

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ fn main() {
620620
commands.push(Box::new(cmd::Secrets::new()));
621621
commands.push(Box::new(cmd::PortForward::new()));
622622
commands.push(Box::new(cmd::PortForwards::new()));
623-
commands.push(Box::new(cmd::OneOff::new()));
623+
commands.push(Box::new(cmd::Run::new()));
624624

625625
let mut rl = Editor::<ClickCompleter>::new();
626626
rl.load_history(hist_path.as_path()).unwrap_or_default();

0 commit comments

Comments
 (0)