Initial commit of vpp code.
[vpp.git] / build-root / emacs-lisp / cli-cmd-skel.el
1 ;;; cli-cmd-skel.el - cli command skeleton
2
3 (require 'skeleton)
4
5 (define-skeleton cli-cmd-skel
6 "Insert a CLI command "
7 nil
8 '(setq cmd-name (skeleton-read "Command Name: "))
9 '(setq path (skeleton-read "Path: "))
10
11 "
12 static 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
27 VLIB_CLI_COMMAND (" cmd-name "_command, static) = {
28     .path = \"" path "\",
29     .short_help = \"" path "\",
30     .function = " cmd-name "_command_fn,
31 };
32 ")