Skip to content

feat: add essential shell commands - pwd, uptime and clearhistory#59

Merged
anshumanjadiya1102 merged 3 commits intoDrive-for-Java:mainfrom
yuvii-b:feature/new-cmds
Oct 18, 2025
Merged

feat: add essential shell commands - pwd, uptime and clearhistory#59
anshumanjadiya1102 merged 3 commits intoDrive-for-Java:mainfrom
yuvii-b:feature/new-cmds

Conversation

@yuvii-b
Copy link
Contributor

@yuvii-b yuvii-b commented Oct 18, 2025

Summary

This PR adds three essential command-line utilities to MyCMD that enhance the shell's functionality and user experience.
(Closes: #51)

Commands

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

Changes Made

  • Added PwdCommand.java, UptimeCommand.java, and ClearHistoryCommand.java
  • Enhanced ShellContext.java with uptime tracking and history management
  • Registered new commands in App.java
  • Fixed HelpCommand.java argument parsing bug (was using args[1] instead of args[0])
  • Added target/ directory to .gitignore since pushing it just bloats the repo and causes unnecessary merge conflicts.

Usage Examples

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

mycmd> uptime
Up since 0h 12m 45s

mycmd> clearhistory
Command history cleared.

Technical Details

  • All commands follow the existing Command interface pattern
  • Commands integrate seamlessly with the help system
  • No breaking changes to existing functionality
  • ShellContext now tracks start time for uptime calculation

Testing

  • All commands compile without errors
  • Commands appear in help listing with descriptions
  • help <command> works for all new commands

@github-actions
Copy link
Contributor

🚀 Hi @yuvii-b!

Thank you for contributing to MyCMD. A maintainer will review your PR shortly. 🎉

1 similar comment
@github-actions
Copy link
Contributor

🚀 Hi @yuvii-b!

Thank you for contributing to MyCMD. A maintainer will review your PR shortly. 🎉

@yuvii-b
Copy link
Contributor Author

yuvii-b commented Oct 18, 2025

This repo was fun to explore! Appreciate how clean and beginner-friendly it is!

@anshumanjadiya1102 anshumanjadiya1102 added hacktoberfest-accepted This is for Hacktoberfest hacktoberfest This is for Hacktoberfest labels Oct 18, 2025
@anshumanjadiya1102
Copy link
Member

Hello @yuvii-b, I really love your contribution. Do you want to be a part of our Community.

@anshumanjadiya1102 anshumanjadiya1102 merged commit 894f0ac into Drive-for-Java:main Oct 18, 2025
4 checks passed
@yuvii-b
Copy link
Contributor Author

yuvii-b commented Oct 18, 2025

Hello @yuvii-b, I really love your contribution. Do you want to be a part of our Community.

Thanks! I’d love to join. @anshumanjadiya1102

@anshumanjadiya1102
Copy link
Member

Hello @yuvii-b, You are invited to our Organization. Now you are a part of Drive-for-Java Community. Thanks for sharing love.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from-fork hacktoberfest This is for Hacktoberfest hacktoberfest-accepted This is for Hacktoberfest needs-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants