blob: cf8658c4233202f9ec58b247a65f8f3abc96e838 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001;;; cli-cmd-skel.el - cli command skeleton
2
3(require 'skeleton)
4
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -07005(define-skeleton skel-cli-cmd
Ed Warnickecb9cada2015-12-08 15:45:58 -07006"Insert a CLI command "
7nil
8'(setq cmd-name (skeleton-read "Command Name: "))
9'(setq path (skeleton-read "Path: "))
10
11"
12static clib_error_t *
13" cmd-name "_command_fn (vlib_main_t * vm,
14 unformat_input_t * input,
15 vlib_cli_command_t * cmd)
16{
17 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
18 if (unformat (input, \"whatever %d\", &whatever))
19 ;
20 else
21 return clib_error_return (0, \"unknown input `%U'\",
22 format_unformat_error, input);
23 }
24 return 0;
25}
26
27VLIB_CLI_COMMAND (" cmd-name "_command, static) = {
28 .path = \"" path "\",
29 .short_help = \"" path "\",
30 .function = " cmd-name "_command_fn,
31};
32")