# tree command

Show tree structure of object

Tree diagram of object, and members satisfying MATCH CRITERIA, to depth N


## USAGE

  / ▶ tree [OPTIONS] [MATCH CRITERIA] [SEARCH LOGIC] PATH

* PATH -- Pobshell path of the object to be diagrammed.
The tree command recursively walks members (attributes & or contents) of the object at PATH. Wildcards aren't supported.

* Current map determines the kind of members included. 
Choose between "map attributes", "map contents" and "map everything"
 - see map command.


## OPTIONS

  -d DEPTH        Depth of tree (default is 2)                        
  -n NUMLINES     Truncate at N lines per entry
  -a,             Include hidden members
  -o, --any       Include objects that satisfy ANY match criteria
  -v, --verbose   Echo fullpath to output

        
## MATCH CRITERIA

* Specify the members of interest.
E.g. 
--ismodule
--isclass
--isroutine   
--typename list  
--matchpy "isinstance(self, Cafe)"


## SEARCH LOGIC

* Prune paths matching abspath pattern, typename or satisfying predicate
  --prune PRUNE [PRUNE ...]
 

## EXAMPLES

  / ▶ tree .
  / ▶ tree -d 1 . --isclass
  / ▶ tree -a .
  / ▶ tree . -d 2  --typename list
  / ▶ tree --ismodule .
  / ▶ tree . --type *ipy*
  / ▶ tree  . -d 2 --prune ismodule  --matchpy "'!' in self" --noraise


* Show all list objects inside current object 

/pobmain ▶ tree . -d 2  --typename list
pobmain  <module 'pobshell.pobmain' from '/Users/peterdalloz/Dropbox/PYTHONDROP…
├── INFOCMD_ARGS  [(('--name',), {'help': 'SUPPRESS', 'metavar': 'PATTERN', 'ty…
├── MissingInfoOptions  <class 'pobshell.common.MissingInfoOptions'>  <class 't…
│   └── choices  ['skip', 'blank', 'message']  <class 'list'>
├── PobPrefs  <pobshell.common.PobPrefsClass object at 0x138a8c500>  <class 'po…
│   ├── lsl_style_list  ['path', 'type', None]  <class 'list'>
│   ├── lsl_styles  [{'fg': <Fg.WHITE: 97>}, {'fg': <Fg.CYAN: 36>}, {}]  <class…
│   ├── lsx_cmds  ['ls -l', 'type -1', 'predicates -1', 'abcs -1', 'memsize -1'…
│   └── lsxv_cmds  ['ls -lv', 'type -1v', 'predicates -1v', 'abcs -1v', 'memsiz…
├── infocmds  <module 'pobshell.infocmds' from '/Users/peterdalloz/Dropbox/PYTH…
│   ├── INFOCMD_ARGS  [(('--name',), {'help': 'SUPPRESS', 'metavar': 'PATTERN',…
│   └── INFOFILTERS  ['name', 'id', 'type', 'typename', 'str', 'repr', 'signatu…
└── sys  <module 'sys' (built-in)>  <class 'module'>
    ├── argv  ['/Users/peterdalloz/Dropbox/PYTHONDROPBOX/pobshell/Use_Cases/deb…
    ├── meta_path  [<_distutils_hack.DistutilsMetaFinder object at 0x101ba75c0>…
    ├── orig_argv  ['python', '/Users/peterdalloz/Dropbox/PYTHONDROPBOX/pobshel…
    ├── path  ['/Users/peterdalloz/Dropbox/PYTHONDROPBOX/pobshell/Use_Cases', '…
    ├── path_hooks  [<class 'zipimport.zipimporter'>, <function FileFinder.path…
    └── warnoptions  []  <class 'list'>


* Show all ipy type objects inside current object
Map/widgets/`'824adbfad1f542fc898213d98e9e2aa1'` ▶ tree . --type *ipy*
`'824adbfad1f542fc898213d98e9e2aa1'`  Toolbar(children=(HBox(children=(ToggleBu…
├── accessory_widget  LayerManager(children=(HBox(children=(Button(button_style…
│   └── layout  Layout()  <class 'ipywidgets.widgets.widget_layout.Layout'>
├── all_widgets  [ToggleButton(value=False, button_style='primary', icon='info'…
│   ├── `0`  ToggleButton(value=False, button_style='primary', icon='info', lay…
│   ├── `1`  ToggleButton(value=False, button_style='primary', icon='bar-chart'…
│   ├── `2`  ToggleButton(value=False, button_style='primary', icon='globe', la…
│   ├── `3`  ToggleButton(value=False, button_style='primary', icon='map', layo…
│   ├── `4`  ToggleButton(value=False, button_style='primary', icon='retweet', …
│   ├── `5`  ToggleButton(value=False, button_style='primary', icon='plus', lay…
│   ├── `6`  ToggleButton(value=False, button_style='primary', icon='eraser', l…
│   ├── `7`  ToggleButton(value=False, button_style='primary', icon='folder-ope…
│   ├── `8`  ToggleButton(value=False, button_style='primary', icon='gears', la…
│   ├── `9`  ToggleButton(value=False, button_style='primary', icon='google', l…
│   ├── `10`  ToggleButton(value=False, button_style='primary', icon='fast-forw…
│   ├── `11`  ToggleButton(value=False, button_style='primary', icon='hand-o-up…
│   ├── `12`  ToggleButton(value=False, button_style='primary', icon='line-char…
│   ├── `13`  ToggleButton(value=False, button_style='primary', icon='random', …
│   ├── `14`  ToggleButton(value=False, button_style='primary', icon='adjust', …
│   ├── `15`  ToggleButton(value=False, button_style='primary', icon='info-circ…
│   └── `16`  ToggleButton(value=False, button_style='primary', icon='question'…
├── children  (HBox(children=(ToggleButton(value=True, icon='server', layout=La…
│   ├── `0`  HBox(children=(ToggleButton(value=True, icon='server', layout=Layo…
│   └── `1`  VBox(children=(LayerManager(children=(HBox(children=(Button(button…
├── grid  GridBox(children=(ToggleButton(value=False, button_style='primary', i…
│   └── layout  Layout(grid_gap='1px 1px', grid_template_columns='32px 32px 32p…
├── host_map  Map(center=[-10.0725, -67.5342], controls=(WidgetControl(options=…
│   ├── default_style  MapStyle()  <class 'ipyleaflet.leaflet.MapStyle'>
│   ├── dragging_style  MapStyle(cursor='move')  <class 'ipyleaflet.leaflet.Map…
│   ├── layout  Layout(height='600px')  <class 'ipywidgets.widgets.widget_layou…
│   └── style  MapStyle()  <class 'ipyleaflet.leaflet.MapStyle'>
├── layers_button  ToggleButton(value=True, icon='server', layout=Layout(height…
│   ├── layout  Layout(height='28px', width='72px')  <class 'ipywidgets.widgets…
│   └── style  ToggleButtonStyle()  <class 'ipywidgets.widgets.widget_bool.Togg…
├── layout  Layout()  <class 'ipywidgets.widgets.widget_layout.Layout'>
├── toggle_tool  Toolbar.Item(icon='plus', tooltip='Expand toolbar', callback=<…
│   └── toggle_button  ToggleButton(value=False, button_style='primary', icon='…
├── toggle_widget  ToggleButton(value=False, button_style='primary', icon='plus…
│   ├── layout  Layout(height='auto', padding='0px 0px 0px 4px', width='auto') …
│   └── style  ToggleButtonStyle()  <class 'ipywidgets.widgets.widget_bool.Togg…
├── toolbar_button  ToggleButton(value=False, icon='wrench', layout=Layout(heig…
│   ├── layout  Layout(height='28px', padding='0px 0px 0px 4px', width='28px') …
│   └── style  ToggleButtonStyle()  <class 'ipywidgets.widgets.widget_bool.Togg…
├── toolbar_footer  VBox(children=(LayerManager(children=(HBox(children=(Button…
│   └── layout  Layout()  <class 'ipywidgets.widgets.widget_layout.Layout'>
└── toolbar_header  HBox(children=(ToggleButton(value=True, icon='server', layo…
    └── layout  Layout(align_items='center', display='flex', justify_content='f…


* Show members which contain an exclamation mark (requires map everything)
    N.B. Excludes members of other modules (--prune ismodule)
    /cmd2 ▶ tree  . -d 2 --prune ismodule  --matchpy "'!' in self" --noraise
    cmd2  <module 'cmd2' from '/opt/anaconda3/envs/PobEnv312all/lib/pytho…
    ├── Cmd  <class 'cmd2.cmd2.Cmd'>  <class 'type'>
    │   ├── alias_create_epilog  'Notes:\n  If you want to use redirectio…
    │   └── macro_create_epilog  'A macro is similar to an alias, but it …
    └── DEFAULT_SHORTCUTS  {'!': 'shell', '?': 'help', '@': 'run_script',…