Explorar o código

cli: improve error handling on editor select call

Use common error functions instead of explicit warn() calls

Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau hai 10 meses
pai
achega
7f0913d7b1

+ 3 - 3
package/utils/cli/files/usr/share/ucode/cli/object-editor.uc

@@ -609,19 +609,19 @@ export function edit_create_destroy(info, node)
 			select: function(ctx, argv) {
 				let name = argv[0];
 				if (!name) {
-					warn(`Missing argument\n`);
+					ctx.missing_argument();
 					return;
 				}
 
 				let obj = object_lookup(ctx, this, this.object_name);
 				if (!obj) {
-					warn(`Object not found\n`);
+					ctx.invalid_argument("Object not found");
 					return;
 				}
 
 				let entry = obj[name];
 				if (!entry) {
-					warn(`${name} not found\n`);
+					ctx.invalid_argument(`${name} not found: %s`, name);
 					return;
 				}