Skip to content

Commit

Permalink
update click options
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorb1 committed Jul 17, 2024
1 parent aa37c4c commit cdcbb76
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ in importing coal, importing RL1, and if RLu is allowed to run or not. Add the f

## 4. Run the workflow
```bash
cd src
python main_ms.py --step_length 5 --input_data ../data/<datafile_name>.txt
step run --step_length 5 --input_data ../data/<datafile_name>.txt
```

## 6. View Results
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Issues = "https://github.com/KTH-dESA/OSeMOSYS_step/issues"
Source = "https://github.com/KTH-dESA/OSeMOSYS_step"

[project.scripts]
step = "osemosys_step.main:main"
step = "osemosys_step.main:cli"

[tool.hatch.version]
source = "vcs"
Expand Down
13 changes: 8 additions & 5 deletions src/osemosys_step/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
def cli():
pass

@cli.command("run")
@click.command()
@click.option("--step_length", required=True, multiple=True,
help="""
Provide an integer to indicate the step length, e.g. '5' for
Expand All @@ -56,7 +56,7 @@ def cli():
saved elsewhere than '../data/scenarios/' on can use this option to
indicate the path.
""")
def main(input_data: str, step_length: int, path_param: str, cores: int, solver=None, foresight=None):
def run(input_data: str, step_length: int, path_param: str, cores: int, solver=None, foresight=None):
"""Main entry point for workflow"""

##########################################################################
Expand Down Expand Up @@ -625,11 +625,11 @@ def main(input_data: str, step_length: int, path_param: str, cores: int, solver=

next_step += 1

@cli.command("create")
@click.command()
@click.option("--path", required=True, default= '.',
help="Path where the directory structure shall be created."
)
def create_directory_structure(path: str):
def setup(path: str):
"""Function to create directory structure in which OSeMOSYS_step can be run.
The created directory has the below structure:
```bash
Expand All @@ -646,5 +646,8 @@ def create_directory_structure(path: str):
p = Path(path, d)
p.mkdir()

cli.add_command(run)
cli.add_command(setup)

if __name__ == '__main__':
cli() #input_data,step_length,path_param,solver)
cli()

0 comments on commit cdcbb76

Please sign in to comment.