linux-command 0.2.1__tar.gz → 0.2.2__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.1
3
+ Version: 0.2.2
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.1"
34
+ VERSION = "0.2.2"
35
35
  PROJECT_URL = "https://github.com/MouxiaoHuang/linux-command"
36
36
 
37
37
 
@@ -76,6 +76,14 @@ commands = {
76
76
  }
77
77
 
78
78
 
79
+ def custom_help():
80
+ print("Available commands:")
81
+ for command, description in commands.items():
82
+ print(f'[{command}]: {description}')
83
+ print(f"For more information, visit: {PROJECT_URL}")
84
+
85
+
86
+
79
87
  def confirm_action(message):
80
88
  """Ask the user to confirm an action, accepting y/n or yes/no"""
81
89
  confirmation = input(f"{message} (yes/no or y/n): ").strip().lower()
@@ -91,29 +99,21 @@ def main():
91
99
  )
92
100
 
93
101
  parser.add_argument('-h', '--help', action='store_true', help='Show this help message and exit')
94
- parser.add_argument('-V', '-v', '--version', action='version', version=f'linux-command {VERSION}', help='Show program\'s version number and exit')
102
+ parser.add_argument('-V', '--version', action='store_true', help='Show program\'s version number and exit')
95
103
 
96
104
  # Main command and subcommands
97
- parser.add_argument('command', type=str, help='Command to execute')
105
+ parser.add_argument('command', nargs='?', help='Command to execute')
98
106
  parser.add_argument('extra', nargs='*', help='Additional arguments for the command')
99
107
 
100
108
  # Parse the arguments
101
109
  args = parser.parse_args()
102
110
 
103
111
  if args.help:
104
- if args.command:
105
- # Show help for a specific command
106
- print(f'{args.command}: {commands.get(args.command, "No help available for this command.")}')
107
- else:
108
- # Show help for all commands
109
- print("Available commands:")
110
- for command, description in commands.items():
111
- print(f' {command}: {description}')
112
- print("\nUse 'cmd -h [command]' to see help for a specific command.")
112
+ custom_help()
113
113
  return
114
114
 
115
- if not args.command:
116
- parser.print_help()
115
+ if args.version:
116
+ print(f'linux-command {VERSION}')
117
117
  return
118
118
 
119
119
  # `ls` commands
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: linux-command
3
- Version: 0.2.1
3
+ Version: 0.2.2
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