betodealmeida commented on a change in pull request #11803:
URL: 
https://github.com/apache/incubator-superset/pull/11803#discussion_r530109641



##########
File path: superset/cli.py
##########
@@ -260,10 +261,30 @@ def import_dashboards(path: str, recursive: bool, 
username: str) -> None:
     "--dashboard-file", "-f", default=None, help="Specify the the file to 
export to"
 )
 @click.option(
-    "--print_stdout", "-p", is_flag=True, default=False, help="Print JSON to 
stdout"
+    "--print_stdout", "-p", is_flag=True, default=False, help="Print JSON to 
stdout",
 )
-def export_dashboards(dashboard_file: str, print_stdout: bool) -> None:
+def export_dashboards(
+    dashboard_file: Optional[str], print_stdout: bool = False
+) -> None:
     """Export dashboards to JSON"""
+    if app.config["DEFAULT_FEATURE_FLAGS"].get("VERSIONED_EXPORT"):
+        from superset.dashboards.commands.export import ExportDashboardsCommand
+        from superset.models.dashboard import Dashboard
+
+        g.user = security_manager.find_user(username="admin")
+
+        dashboard_ids = [id_ for (id_,) in 
db.session.query(Dashboard.id).all()]
+        timestamp = datetime.now().strftime("%Y%m%dT%H%M%S")
+        root = f"dashboard_export_{timestamp}"
+        dashboard_file = dashboard_file or f"{root}.zip"

Review comment:
       I played with click trying to have options depend on the feature flag, 
but couldn't get it to work since it depends on the app context. Let me give it 
another try.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to