mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
fix #291: give backups a default name that includes a timestamp
this prevents backups from being overwritten by accident.
This commit is contained in:
parent
bb5d7b3adf
commit
7b2bfcb247
1 changed files with 7 additions and 3 deletions
|
|
@ -10,7 +10,6 @@ import hashlib
|
|||
import csv
|
||||
import urllib.request
|
||||
from datetime import datetime
|
||||
from datetime import date
|
||||
from Crypto.Hash import SHA512
|
||||
|
||||
from progressbar.bar import ProgressBar
|
||||
|
|
@ -558,10 +557,15 @@ def main():
|
|||
"--peek", required=False, help="Inspect an address", type=auto_int, metavar=('ADDR')
|
||||
)
|
||||
parser.add_argument(
|
||||
"--output", help="Output file name", type=str, default="backup.pddb"
|
||||
"--output", help="Output file name. Defaults to ./backup_<current_iso_time>.pddb", type=str, default=None
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.output is None:
|
||||
ofile = "backup_{}.pddb".format(datetime.now().isoformat())
|
||||
else:
|
||||
ofile = args.output
|
||||
|
||||
dev = usb.core.find(idProduct=0x5bf0, idVendor=0x1209)
|
||||
|
||||
if dev is None:
|
||||
|
|
@ -627,7 +631,7 @@ def main():
|
|||
if args.peek:
|
||||
pc_usb.peek(args.peek + flash_region, display=True)
|
||||
else:
|
||||
with open(args.output, "wb") as file:
|
||||
with open(ofile, "wb") as file:
|
||||
checksum = []
|
||||
start_addr = locs['LOC_PDDB'][0] - 0x1000
|
||||
total_length = locs['LOC_WF200'][0] - locs['LOC_PDDB'][0] + 0x1000
|
||||
|
|
|
|||
Loading…
Reference in a new issue