Browse Source

make sure all files are processed..

this makes pre-caching files easier, and likely more what a user
expects..
main
John-Mark Gurney 1 year ago
parent
commit
5a4fe83d64
2 changed files with 9 additions and 3 deletions
  1. +3
    -2
      ui/fixtures/cmd.basic.json
  2. +6
    -1
      ui/medashare/cli.py

+ 3
- 2
ui/fixtures/cmd.basic.json View File

@@ -118,9 +118,10 @@
},
{
"title": "test file is not present",
"cmd": [ "list", "test.txt" ],
"cmd": [ "list", "test.txt", "newfile.txt" ],
"exit": 1,
"stderr": "ERROR: file not found: 'test.txt'\n"
"stderr": "ERROR: file not found: 'test.txt'\n",
"stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
},
{
"special": "copy newfile.txt to test.txt"


+ 6
- 1
ui/medashare/cli.py View File

@@ -1377,6 +1377,7 @@ def cmd_auto(options):

@init_datastructs
def cmd_list(options, persona, objstr, cache):
exit = 0
for i in options.files:
try:
objs = objstr.by_file(i)
@@ -1390,12 +1391,16 @@ def cmd_list(options, persona, objstr, cache):
objs = objstr.by_file(i)
except (FileNotFoundError, KeyError) as e:
print('ERROR: file not found: %s' % repr(i), file=sys.stderr)
sys.exit(1)
exit = 1
continue

for j in objstr.by_file(i):
for k, v in _iterdictlist(j):
print('%s:\t%s' % (k, v))

if exit:
sys.exit(exit)

def handle_bittorrent(fname, persona, objstr):
with open(fname, 'rb') as fp:
torrent = bencode.bdecode(fp.read())


Loading…
Cancel
Save