-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored CLI layout to be more intuitive in terms of naming, and al…
…so the module logic is no longer imported into weird places before executing (#30)
- Loading branch information
Showing
54 changed files
with
108 additions
and
103 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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from cli import commands, modules, exe | ||
from cli import define, applications, parse | ||
|
||
__all__ = ["commands", "modules", "exe"] | ||
__all__ = ["define", "applications", "parse"] |
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,3 @@ | ||
from cli.applications import lacce, mhw, ops, kerchunk, update | ||
|
||
__all__ = ["lacce", "mhw", "ops", "kerchunk", "update"] |
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,3 @@ | ||
from cli.applications.kerchunk.run import run | ||
|
||
__all__ = ["run"] |
File renamed without changes.
File renamed without changes.
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,4 @@ | ||
from cli.applications.mhw.start import start | ||
from cli.applications.mhw.thresholds import create_thresholds | ||
|
||
__all__ = ["start", "create_thresholds"] |
3 changes: 2 additions & 1 deletion
3
toolkit/cli/modules/mhw/start/__init__.py → ...it/cli/applications/mhw/start/__init__.py
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
6 changes: 3 additions & 3 deletions
6
...it/cli/modules/mhw/thresholds/__init__.py → ...i/applications/mhw/thresholds/__init__.py
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
3 changes: 3 additions & 0 deletions
3
toolkit/cli/applications/mhw/thresholds/catalogue/__init__.py
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,3 @@ | ||
from cli.applications.mhw.thresholds.catalogue.update_cache import update_cache | ||
|
||
__all__ = ["update_cache"] |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
toolkit/cli/applications/mhw/thresholds/climatology/__init__.py
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,4 @@ | ||
from cli.applications.mhw.thresholds.climatology.daily import calculate_daily_clim | ||
from cli.applications.mhw.thresholds.climatology.define_mhw import calculate_mhw | ||
|
||
__all__ = ["calculate_daily_clim", "calculate_mhw"] |
File renamed without changes.
File renamed without changes.
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,5 @@ | ||
from cli.applications.ops.download import download | ||
from cli.applications.ops.transform import transform | ||
from cli.applications.ops.load import load | ||
|
||
__all__ = ["download", "transform", "load"] |
4 changes: 2 additions & 2 deletions
4
toolkit/cli/modules/ops/download/__init__.py → ...cli/applications/ops/download/__init__.py
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
2 changes: 1 addition & 1 deletion
2
.../cli/modules/ops/download/gfs/__init__.py → ...applications/ops/download/gfs/__init__.py
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...t/cli/modules/ops/load/values/__init__.py → .../applications/ops/load/values/__init__.py
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
from cli.define import lacce, mhw, ops, kerchunk, update | ||
|
||
__all__ = ["lacce", "mhw", "ops", "kerchunk", "update"] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from cli.exe import lacce, mhw, ops, kerchunk, update | ||
from cli.parse import lacce, mhw, ops, kerchunk, update | ||
|
||
__all__ = ["lacce", "mhw", "ops", "kerchunk", "update"] |
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,5 @@ | ||
def parse(cmd, args, module): | ||
if args.kerchunk_command == "run": | ||
return module.run | ||
else: | ||
print(cmd.format_help()) |
4 changes: 2 additions & 2 deletions
4
toolkit/cli/exe/lacce/__init__.py → toolkit/cli/parse/lacce/__init__.py
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
def run(cmd, args): | ||
def parse(cmd, args, module): | ||
input = args.input | ||
output = args.output | ||
if input and output: | ||
print("LACCE", input, output) | ||
return | ||
return lambda: print("Not implemented") | ||
print(cmd.format_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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def parse(cmd, args, module): | ||
if args.mhw_command == "start": | ||
return module.start | ||
else: | ||
print(cmd.format_help()) |
11 changes: 4 additions & 7 deletions
11
toolkit/cli/exe/ops/__init__.py → toolkit/cli/parse/ops/__init__.py
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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
from cli.modules.ops import download, load, transform | ||
|
||
|
||
def run(cmd, args): | ||
def parse(cmd, args, module): | ||
if args.ops_command == "download": | ||
download(args) | ||
return module.download | ||
elif args.ops_command == "transform": | ||
transform(args) | ||
return module.transform | ||
elif args.ops_command == "load": | ||
load(args) | ||
return module.load | ||
else: | ||
print(cmd.format_help()) |
9 changes: 2 additions & 7 deletions
9
toolkit/cli/exe/update/__init__.py → toolkit/cli/parse/update/__init__.py
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 |
---|---|---|
@@ -1,13 +1,8 @@ | ||
from cli.modules.update.update_bashrc import update_bashrc | ||
|
||
|
||
def run(cmd, args): | ||
def run(cmd, args, module): | ||
version = args.version | ||
reset = args.reset | ||
if reset and version: | ||
raise Exception("Please specify either reset or version flags") | ||
|
||
if version or reset: | ||
update_bashrc(args) | ||
return | ||
return module.update_bashrc | ||
print(cmd.format_help()) |