mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-11 08:33:02 +03:00
Allow creating new file via the command line, if file doesn't exist
This commit is contained in:
parent
cf81a4236a
commit
03ce16e100
@ -3449,9 +3449,14 @@ if args.filename:
|
||||
# app.image = AnsiArtDocument.from_text(sys.stdin.read())
|
||||
# app.filename = "<stdin>"
|
||||
# else:
|
||||
with open(args.filename, 'r') as my_file:
|
||||
app.image = AnsiArtDocument.from_text(my_file.read())
|
||||
app.image_initialized = True
|
||||
try:
|
||||
with open(args.filename, 'r') as my_file:
|
||||
app.image = AnsiArtDocument.from_text(my_file.read())
|
||||
app.image_initialized = True
|
||||
app.file_path = os.path.abspath(args.filename)
|
||||
except FileNotFoundError:
|
||||
# Sometimes you just want to name a new file from the command line.
|
||||
# Hopefully this won't be too confusing since it will be blank.
|
||||
app.file_path = os.path.abspath(args.filename)
|
||||
if args.recode_samples:
|
||||
# Re-encode the sample files to test for changes/inconsistency in encoding.
|
||||
|
Loading…
Reference in New Issue
Block a user