linux-command 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: linux-command
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: A command line tool to perform custom tasks.
5
5
  Home-page: https://github.com/MouxiaoHuang/linux-command
6
6
  Author: Mouxiao Huang
@@ -31,7 +31,7 @@ import glob
31
31
 
32
32
 
33
33
  # Define the version
34
- VERSION = "0.2.2"
34
+ VERSION = "0.2.3"
35
35
  PROJECT_URL = "https://github.com/MouxiaoHuang/linux-command"
36
36
 
37
37
 
@@ -44,9 +44,11 @@ commands = {
44
44
  'ls-dir': 'Count all directories. Same as `lsd`.',
45
45
  'ls-reverse': 'List files and directories in reverse order.',
46
46
  'ls-time': 'List sorted by modification time, newest first.',
47
+ 'ls-human': 'List in human-readable format (for file sizes)',
48
+ 'ls-long': 'Long format listing',
49
+ 'ls-size': 'Sort files by size',
47
50
  'ls-recursive-size': 'List all files and directories recursively, with sizes in human-readable format',
48
51
  'ls-bs': 'Display the size of each file in specified block size (e.g., K, M, G).',
49
- 'ls-size': 'Display the size of each file in specified block size (e.g., K, M, G).',
50
52
  'ls-block-size': 'Display the size of each file in specified block size (e.g., K, M, G).',
51
53
  'ps': 'Basic process list.',
52
54
  'ps-all': 'Show all processes.',
@@ -156,6 +158,22 @@ def main():
156
158
  options = ' '.join(args.extra)
157
159
  os.system(f'ls -lt {options}')
158
160
 
161
+ elif args.command == 'ls-long':
162
+ # Long format listing
163
+ if len(args.extra) == 0:
164
+ os.system('ls -l')
165
+ else:
166
+ options = ' '.join(args.extra)
167
+ os.system(f'ls -l {options}')
168
+
169
+ elif args.command == 'ls-human':
170
+ # List in human-readable format (for file sizes)
171
+ if len(args.extra) == 0:
172
+ os.system('ls -lh')
173
+ else:
174
+ options = ' '.join(args.extra)
175
+ os.system(f'ls -lh {options}')
176
+
159
177
  elif args.command == 'ls-recursive-size':
160
178
  # List all files and directories recursively, with sizes in human-readable format
161
179
  if len(args.extra) == 0:
@@ -164,7 +182,15 @@ def main():
164
182
  options = ' '.join(args.extra)
165
183
  os.system(f'ls -lRh {options}')
166
184
 
167
- elif args.command == 'ls-block-size' or args.command == 'ls-bs' or args.command == 'ls-size':
185
+ elif args.command == 'ls-size':
186
+ # Sort files by size
187
+ if len(args.extra) == 0:
188
+ os.system('ls -lS')
189
+ else:
190
+ options = ' '.join(args.extra)
191
+ os.system(f'ls -lS {options}')
192
+
193
+ elif args.command == 'ls-block-size' or args.command == 'ls-bs':
168
194
  # Display the size of each file in specified block size
169
195
  if len(args.extra) == 1:
170
196
  block_size = args.extra[0]
@@ -292,10 +318,15 @@ def main():
292
318
  tar_files = glob.glob(os.path.join(source, '*.tar')) + glob.glob(os.path.join(source, '*.tar.gz'))
293
319
 
294
320
  for tar_file in tar_files:
295
- os.system(f'tar -xzf {tar_file} -C {destination}')
296
- elif source.endswith('.tar.gz') or source.endswith('.tar'):
297
- # Extract a single tar file
298
- os.system(f'tar -xzf {source} -C {destination}')
321
+ if tar_file.endswith('.tar'):
322
+ os.system(f'tar -xvf {tar_file} -C {destination}')
323
+ elif tar_file.endswith('.tar.gz'):
324
+ os.system(f'tar -xzvf {tar_file} -C {destination}')
325
+ # Extract a single tar file
326
+ elif source.endswith('.tar.gz'):
327
+ os.system(f'tar -xzvf {source} -C {destination}')
328
+ elif source.endswith('.tar'):
329
+ os.system(f'tar -xvf {source} -C {destination}')
299
330
  else:
300
331
  print('Please provide a valid .tar or .tar.gz file, or a directory containing such files.')
301
332
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: linux-command
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: A command line tool to perform custom tasks.
5
5
  Home-page: https://github.com/MouxiaoHuang/linux-command
6
6
  Author: Mouxiao Huang
File without changes
File without changes
File without changes
File without changes