How to append custom completion to ConfD command redirection


Is there a way to add options to Confd command output processing?
In particular I want to add “head” possible completions to my command output processing that will give me the #n first lines (in case n is positive, n last lines in case it is negative and all lines in case n equal zero).

So it will look like this:

admin@CableOS> show running-config |       
Possible completions:
  append          Append output text to a file
  begin           Begin with the line that matches
  best-effort     Display data even if data provider is unavailable or continue loading from file in presence of failures
  context-match   Context match
  count           Count the number of lines in the output
  csv             Show table output in CSV format
  de-select       De-select columns
  details         Display default values
  display         Display options
  exclude         Exclude lines that match
  extended        Display referring entries
  include         Include lines that match
  linnum          Enumerate lines in the output
  match-all       All selected filters must match
  match-any       At least one filter must match
  more            Paginate output
  nomore          Suppress pagination
  repeat          Repeat show command with a given interval
  save            Save output text to a file
  select          Select additional columns
  sort-by         Select sorting indices
  tab             Enforce table output
  until           End with the line that matches
  head          displays only the first n lines

I read many posts here including Confd spec and I didn’t find any solution to it.
except that those possible completions are located in :


file in the following way:
<command><pattern>configure linnum</pattern></command>

You want to use the clispec, addPipeFlags, and pipeCmds.
I believe this post from 4 years ago is close enough for what you want to do: