skill.cli_format¶
Terminal-friendly formatting for CLI output.
Functions
|
Format a {name: path} dict as readable output. |
|
Format a full Skill for terminal display. |
|
Format a single SkillInfo as a compact one-liner. |
|
Format a list of SkillInfo as an aligned, readable table. |
|
Format a list of source dicts for terminal display. |
- skill.cli_format.format_path_dict(d, *, verb='Installed')[source]¶
Format a {name: path} dict as readable output.
- Return type:
>>> from pathlib import Path >>> out = format_path_dict({'claude-code': Path('/a/b')}, verb='Installed') >>> 'claude-code' in out True
- skill.cli_format.format_skill(skill, *, url=None, dep_warnings=None)[source]¶
Format a full Skill for terminal display.
- Return type:
>>> from skill.base import SkillMeta >>> s = Skill(meta=SkillMeta(name='test', description='A test'), body='# Hello') >>> 'Name:' in format_skill(s) True >>> 'WARNING' in format_skill(s, dep_warnings=['Missing dependencies: alice/foo']) True
- skill.cli_format.format_skill_info(info)[source]¶
Format a single SkillInfo as a compact one-liner.
- Return type:
>>> si = SkillInfo('owner/test', 'test', 'A test skill', 'local', installed=True) >>> '✓' in format_skill_info(si) True
- skill.cli_format.format_skill_info_table(items)[source]¶
Format a list of SkillInfo as an aligned, readable table.
Shows URL on a second line when available.
- Return type:
>>> items = [ ... SkillInfo('alice/lint', 'lint', 'Lint Python code', 'local', installed=True), ... SkillInfo('bob/react-tips', 'react-tips', 'React best practices guide', 'github', ... url='https://github.com/bob/react-tips'), ... ] >>> out = format_skill_info_table(items) >>> '✓' in out and 'alice/lint' in out True >>> 'https://github.com/bob/react-tips' in out True