Skip to content

Commit

Permalink
Merge pull request #751 from kbevers/fire-config
Browse files Browse the repository at this point in the history
Tilføj kommando `fire config`
  • Loading branch information
kbevers authored Apr 25, 2024
2 parents 9f46a9e + 4e08c2c commit f894838
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/apps/config.rst
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

1 change: 1 addition & 0 deletions docs/apps/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Kommandolinjeprogrammer
.. toctree::
:maxdepth: 2

config
info
niv
indlæs
Expand Down
30 changes: 30 additions & 0 deletions fire/cli/config.py
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()
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ def readme():
luk=fire.cli.luk:luk
indlæs=fire.cli.indlæs:indlæs
ts=fire.cli.ts:ts
config=fire.cli.config:config
""",
)

0 comments on commit f894838

Please sign in to comment.