Skip to content

Commit 5260858

Browse files
committed
feat: expose codeflare rename profile src dst command
This PR does not expose any graphical UI over this command, only the command handler.
1 parent cda8d2b commit 5260858

File tree

4 files changed

+38
-9
lines changed

4 files changed

+38
-9
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/plugin-codeflare/src/controller/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export default function registerCodeflareCommands(registrar: Registrar) {
4848
height: 800,
4949
})
5050

51+
registrar.listen("/codeflare/rename/profile", (args) => import("./profile/rename").then((_) => _.default(args)))
52+
5153
registrar.listen("/codeflare/get/profile", (args) => import("./profile/get").then((_) => _.default(args)), {
5254
needsUI: true,
5355
})
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright 2022 The Kubernetes Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { Profiles } from "madwizard"
18+
import { Arguments } from "@kui-shell/core"
19+
20+
export default async function renameProfile(args: Arguments) {
21+
const N = args.argvNoOptions.length - 1
22+
const src = args.argvNoOptions[N - 1]
23+
const dst = args.argvNoOptions[N]
24+
25+
await Profiles.rename({}, src, dst)
26+
return true
27+
}

plugins/plugin-madwizard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"access": "public"
2424
},
2525
"dependencies": {
26-
"madwizard": "^0.15.7"
26+
"madwizard": "^0.15.9"
2727
}
2828
}

0 commit comments

Comments
 (0)