Skip to content

Commit

Permalink
allows resetting configuration bits
Browse files Browse the repository at this point in the history
I didn't include the reset ALL, too dangerous?

#203
  • Loading branch information
ThomasLecocq committed Jul 30, 2024
1 parent 05365e6 commit 3a12131
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion msnoise/scripts/msnoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def db_import(table, format, force):
from ..api import connect, get_engine, read_db_inifile
from sqlalchemy import MetaData
import pandas as pd
dbini = read_db_inifile()
dbini = read_db_inifile(inifile=os.path.join(os.getcwd(), 'db.ini'))

if format == "csv":
engine = get_engine(inifile=os.path.join(os.getcwd(), 'db.ini'))
Expand Down Expand Up @@ -595,6 +595,23 @@ def config_get(names):
db.close()


@config.command(name='reset')
@click.argument('names', nargs=-1)
def config_reset(names):
"""
Reset the value of the given configuration variable(s) to their default.
"""
from ..default import default
from ..api import connect, update_config
for key in names:
default_value = default[key].default
print(default_value)
db = connect()
update_config(db, key, default_value)
# db.commit()
db.close()
click.echo("Successfully reset parameter %s = %s" % (key, default_value))


@cli.command()
@click.argument('jobtype')
Expand Down

0 comments on commit 3a12131

Please sign in to comment.