File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import logging
44
55import click
66
7+ from kt .commands .list_kernels .command import list_kernels
8+
79epilog = """
810Base of all tooling used for kernel development.
911
@@ -19,6 +21,7 @@ def cli():
1921def main ():
2022 logging .basicConfig (format = "%(levelname)s:%(message)s" , level = logging .INFO )
2123
24+ cli .add_command (list_kernels )
2225 cli ()
2326
2427
Original file line number Diff line number Diff line change @@ -100,3 +100,48 @@ if the base_path is ~/ciq.
100100
101101The KernelInfo dataclass will be used later when we set up each kernel working
102102environment.
103+
104+ ## Commands
105+
106+ Make sure kt is reachable from anywhere by adding it's location to PATH.
107+ Example
108+ ```
109+ export PATH=$HOME/ciq/kernel-src-tree-tools/bin:$PATH
110+ ```
111+ If you are unsure how to use kt, just run it with --help.
112+ Example:
113+ ```
114+ $ kt --help
115+ ```
116+
117+ Run --help for subcommands as well.
118+
119+ Autocompletion works relatively well. Make sure it's enabled for your shell.
120+ Check the official doc for [ click] ( https://click.palletsprojects.com/en/stable/shell-completion/#enabling-completion )
121+ Example for zsh:
122+ ```
123+ eval "$(_KT_COMPLETE=zsh_source kt)"
124+ ```
125+
126+ A command implementation is under ``` kt/commands/<command> ``` folder.
127+ To keep things cleaner, the actual logic is done in impl.py,
128+ while command.py is used for the click interface, like argument and helper logic.
129+
130+ ### kt list-kernels
131+ It shows the kernels we currently maintain. The data is taken from
132+ KernelsInfo object which represents the kernels.yaml file in kt/data.
133+
134+ Example:
135+
136+ ```
137+ $ kt list-kernels
138+ cbr-7.9
139+ fips-8.10
140+ fips-8.6
141+ fips-9.2
142+ fipslegacy-8.6
143+ lts-8.6
144+ lts-8.8
145+ lts-9.2
146+ lts-9.4
147+ ```
Original file line number Diff line number Diff line change 1+ import click
2+
3+ from kt .commands .list_kernels .impl import main
4+
5+ epilog = """
6+ It list all the kernels we currently maintain.
7+
8+ Example:
9+
10+ \b
11+ $ kt list-kernels
12+
13+ """
14+
15+
16+ @click .command (epilog = epilog )
17+ def list_kernels ():
18+ main ()
Original file line number Diff line number Diff line change 1+ from kt .ktlib .config import Config
2+ from kt .ktlib .kernels import KernelsInfo
3+
4+
5+ def main ():
6+ config = Config .load ()
7+ kernels = KernelsInfo .from_yaml (config = config ).kernels
8+ for k in sorted (kernels ):
9+ print (k )
You can’t perform that action at this time.
0 commit comments