@@ -71,7 +71,7 @@ def version():
71
71
"""Print version, license and exit"""
72
72
if args .version :
73
73
print (
74
- """lsi version 1.1.0
74
+ """lsi version 1.1.1
75
75
76
76
Copyright (c) 2017 js-d-coder (www.github.com/js-d-coder)
77
77
@@ -100,34 +100,25 @@ THE SOFTWARE.
100
100
101
101
def createFileList (dirname ):
102
102
"""create list of files in given directory based on various options"""
103
- dirContents = []
104
- all = os .listdir (dirname )
103
+ files = []
104
+ dirs = []
105
+ all_files = os .listdir (dirname )
106
+
105
107
if args .non_hidden :
106
- if args .only_files :
107
- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
108
- elif args .only_dir :
109
- dirContents = [file + "/" for file in all if os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
110
- else :
111
- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
112
- dirContents += [file + "/" for file in all if os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
108
+ files = [file for file in all_files if not os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
109
+ dirs = [file + "/" for file in all_files if os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
113
110
elif args .hidden :
114
- if args .only_files :
115
- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
116
- elif args .only_dir :
117
- dirContents = [file + "/" for file in all if os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
118
- else :
119
- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
120
- dirContents += [file + "/" for file in all if os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
111
+ files = [file for file in all_files if not os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
112
+ dirs = [file + "/" for file in all_files if os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
121
113
else :
122
- if args .only_files :
123
- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file )]
124
- elif args .only_dir :
125
- dirContents = [file + "/" for file in all if os .path .isdir (dirname + "/" + file )]
126
- else :
127
- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file )]
128
- dirContents += [file + "/" for file in all if os .path .isdir (dirname + "/" + file )]
129
- return dirContents
130
-
114
+ files = [file for file in all_files if not os .path .isdir (dirname + "/" + file )]
115
+ dirs = [file + "/" for file in all_files if os .path .isdir (dirname + "/" + file )]
116
+ if args .only_files :
117
+ return files
118
+ elif args .only_dir :
119
+ return dirs
120
+ else :
121
+ return files + dirs
131
122
132
123
def xargsInput ():
133
124
"""create string of null terminated file names for processing by xargs command"""
0 commit comments