-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding confirmation to override a file during export and convert oper…
…ation in cli
- Loading branch information
1 parent
0b58bf7
commit 03c7208
Showing
3 changed files
with
36 additions
and
14 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
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,21 @@ | ||
# Copyright 2024 Marimo. All rights reserved. | ||
|
||
from pathlib import Path | ||
from sys import stdin | ||
|
||
from marimo._config.settings import GLOBAL_SETTINGS | ||
|
||
|
||
def prompt_to_overwrite(path: Path) -> bool: | ||
if GLOBAL_SETTINGS.YES: | ||
return False | ||
|
||
# Check if not in an interactive terminal | ||
# default to False | ||
if not stdin.isatty(): | ||
return False | ||
|
||
if path.exists(): | ||
return True | ||
|
||
return False |