Skip to content

[FEATURE] Add new commands: pwd, clearhistory, and uptime #51

@yuvii-b

Description

@yuvii-b

Problem:

Currently, the mycmd project lacks a few helpful commands that are standard in many command-line tools.
For example, there’s no command to display the current working directory (pwd), clear the command history (clearhistory), or show how long the shell has been active (uptime).
These additions would make mycmd more feature-complete and user-friendly.

Solution:

Add the following commands:

  • pwd: Prints the current working directory.
  • clearhistory: Clears the stored command history.
  • uptime: Displays how long the shell has been running since startup.

Implementation and Alternatives:

  • Each command will follow the existing command structure and integrate with the core command registry.
  • Extending the existing HistoryCommand to support a -c flag for clearing history, but a dedicated clearhistory command keeps usage simpler.
  • Tracking uptime as part of the VersionCommand, though a standalone uptime command provides a cleaner experience.

Example:

mycmd> pwd
C:\Users\root\Projects\mycmd

mycmd> uptime
Up since 0h 12m 45s

mycmd> clearhistory
Command history cleared.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions