-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #751 from kbevers/fire-config
Tilføj kommando `fire config`
- Loading branch information
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
fire config | ||
############## | ||
|
||
.. click:: fire.cli.config:config | ||
:prog: fire config | ||
:nested: full | ||
|
||
.. program-output:: fire config --help | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ Kommandolinjeprogrammer | |
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
config | ||
info | ||
niv | ||
indlæs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
fire config - vis den lokale FIRE opsætning | ||
""" | ||
|
||
import click | ||
|
||
import fire | ||
import fire.cli | ||
|
||
|
||
@click.command() | ||
def config(): | ||
""" | ||
Udskriv den aktuelle opsætning af FIRE. | ||
Viser indholdet af konfigurationsfilen fire.ini, samt diverse opsætnignsparametre | ||
med standardværdier som ikke er sat eksplicit i konfigurationsfilen. | ||
""" | ||
firedb = fire.cli.firedb | ||
|
||
sections = firedb.config.sections() | ||
|
||
for section in sections: | ||
fire.cli.print(f"[{section}]", fg="green") | ||
for option in firedb.config.options(section): | ||
value = firedb.config.get(section, option) | ||
if option == "password": | ||
value = "*" * 15 | ||
fire.cli.print(f" {option} = {value}") | ||
fire.cli.print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters