Skip to content

Commit a023918

Browse files
committed
Tweaked option name.
1 parent 87454ec commit a023918

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/datacustomcode/cli.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ def deploy(
145145

146146
@cli.command()
147147
@click.argument("directory", default=".")
148-
@click.option("--type", default="script", type=click.Choice(["script", "function"]))
149-
def init(directory: str, type: str):
148+
@click.option(
149+
"--code-type", default="script", type=click.Choice(["script", "function"])
150+
)
151+
def init(directory: str, code_type: str):
150152
from datacustomcode.scan import (
151153
dc_config_json_from_file,
152154
update_config,
@@ -155,18 +157,18 @@ def init(directory: str, type: str):
155157
from datacustomcode.template import copy_function_template, copy_script_template
156158

157159
click.echo("Copying template to " + click.style(directory, fg="blue", bold=True))
158-
if type == "script":
160+
if code_type == "script":
159161
copy_script_template(directory)
160-
elif type == "function":
162+
elif code_type == "function":
161163
copy_function_template(directory)
162164
entrypoint_path = os.path.join(directory, "payload", "entrypoint.py")
163165
config_location = os.path.join(os.path.dirname(entrypoint_path), "config.json")
164166

165167
# Write package type to SDK-specific config
166-
sdk_config = {"type": type}
168+
sdk_config = {"type": code_type}
167169
write_sdk_config(directory, sdk_config)
168170

169-
config_json = dc_config_json_from_file(entrypoint_path, type)
171+
config_json = dc_config_json_from_file(entrypoint_path, code_type)
170172
with open(config_location, "w") as f:
171173
json.dump(config_json, f, indent=2)
172174

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_init_command(
4141
# Create test directory structure
4242
os.makedirs(os.path.join("test_dir", "payload"), exist_ok=True)
4343

44-
result = runner.invoke(init, ["test_dir", "--type", "script"])
44+
result = runner.invoke(init, ["test_dir", "--code-type", "script"])
4545

4646
assert result.exit_code == 0
4747
mock_copy.assert_called_once_with("test_dir")

0 commit comments

Comments
 (0)