Repository: fractal-analytics-platform/fractal-client (language: python)

Issue:
Small fixes to `fractal workflow export`
1. `workflow_id` should be a positional argument
2. let's add the `indent` keyword in `json.dump`


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e50cfa01e..18e810eb0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 1.0.5
+
+* Minor updates to `fractal workflow export` (\#429).
+
 # 1.0.4
 
 * Add `fractal workflow {import,export}` commands (\#426).
diff --git a/fractal/cmd/_workflow.py b/fractal/cmd/_workflow.py
index 42f862509..985c2dc97 100644
--- a/fractal/cmd/_workflow.py
+++ b/fractal/cmd/_workflow.py
@@ -275,7 +275,7 @@ async def workflow_export(
         res, expected_status_code=200, coerce=WorkflowExport
     )
     with Path(json_file).open("w") as f:
-        json.dump(workflow.dict(), f)
+        json.dump(workflow.dict(), f, indent=2)
     return PrintInterface(
         retcode=0, data=f"Workflow {workflow_id} exported at {json_file}"
     )
diff --git a/fractal/parser.py b/fractal/parser.py
index e10871d05..a34b94321 100644
--- a/fractal/parser.py
+++ b/fractal/parser.py
@@ -495,9 +495,8 @@
     description="Export workflow to file",
 )
 workflow_export_parser.add_argument(
-    "--workflow-id",
+    "workflow_id",
     help="Workflow ID",
-    required=True,
 )
 workflow_export_parser.add_argument(
     "--json-file",


Test patch:
diff --git a/tests/test_workflow.py b/tests/test_workflow.py
index 88fa6c859..7d82cd4b0 100644
--- a/tests/test_workflow.py
+++ b/tests/test_workflow.py
@@ -477,9 +477,7 @@ async def test_workflow_export(
     wf = await workflow_factory(name=NAME)
     wf_id = wf.id
     filename = str(tmp_path / "exported_wf.json")
-    res = await invoke(
-        f"workflow export --workflow-id {wf_id} --json-file {filename}"
-    )
+    res = await invoke(f"workflow export {wf_id} --json-file {filename}")
     debug(res.data)
     assert res.retcode == 0
     with open(filename, "r") as f: