File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ parameters in <angle brackets>.
1111
1212` warnet ` commands are organized in a hierarchy of categories and subcommands.
1313
14+ Check the version of warnet using ` warnet version ` .
15+
1416## API Commands
1517
1618### ` warnet auth `
Original file line number Diff line number Diff line change 11import click
2+ import importlib .metadata
23
34from .admin import admin
45from .bitcoin import bitcoin
1718def cli ():
1819 pass
1920
21+ @click .command ()
22+ def version () -> None :
23+ """Display the installed version of warnet"""
24+ try :
25+ version = importlib .metadata .version ("warnet" )
26+ click .echo (f"warnet version { version } " )
27+ except importlib .metadata .PackageNotFoundError :
28+ click .echo ("warnet version unknown (package not installed)" )
2029
2130cli .add_command (admin )
2231cli .add_command (auth )
@@ -37,7 +46,7 @@ def cli():
3746cli .add_command (status )
3847cli .add_command (stop )
3948cli .add_command (create )
40-
49+ cli . add_command ( version )
4150
4251if __name__ == "__main__" :
4352 cli ()
You can’t perform that action at this time.
0 commit comments