---
feature_story: FS_01_89_09_24
feature_title: tree path selecting interp
feature_status: TEST
---

`FirstArgInterp` (FS_42_76_93_51) binds command name to specific `AbstractInterp`.
The specific implementation is commonly based on `FuncArgsInterp` which
immediately utilises `search_control` (FS_31_70_49_15) with very specific list of properties to search.

For example, this command line (using TD_63_37_05_36 demo data) looks up function based on two args:
*   `goto`
*   `service`

```sh
some_command           goto service prod downstream
```

What if we need to invoke some special functions which only require action (without object)?

For example, `intercept` func (FS_88_66_66_73) should be selected only by action (matching its name `intercept`)
_without_ consuming any other args according to `search_control` config specified for `FirstArgInterpFactory`.

```sh
some_command intercept goto service prod downstream
```

The approach is to define a tree where each interpreter is configured on a leaf of that tree:

```
├── intercept                 # `intercept` leaf configured with special interpreter consuming only `intercept` action
├── help                      # `help` leaf configured with special interpreter consuming only `help` action
├── some sub-command          # ...
│   ├── some sub-sub-command  # ...
│   └── [*]                   # default leaf when sub-sub-command is not recognized (some of the func searched here)
└── [*]                       # default leaf when sub-command is not recongnized (most of the func searched here)
```

The tree is a config for `TreePathInterpFactory` - its `TreePathInterp` selects next interp based on the tree path
selected by the args on the command line.

Currently, `TreePathInterp` uses the beginning of the command line, but can be enhanced for use cases where
the match should be done on any base arg ipos.
