Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command prompt variables #50

Merged
merged 2 commits into from
Jun 2, 2024
Merged

Conversation

kardolus
Copy link
Owner

@kardolus kardolus commented Jun 2, 2024

Summary:

This PR introduces the ability to use dynamic variables in the command prompt for interactive mode in the ChatGPT CLI. The following variables have been added:

  • %date: The current date in the format YYYY-MM-DD.
  • %time: The current time in the format HH:MM:SS.
  • %datetime: The current date and time in the format YYYY-MM-DD HH:MM:SS.
  • %counter: The current counter value.
  • %usage: The current usage value.

Changes:

  • Updated the README to reflect the new variables.
  • Modified the main file to utilize the new FormatPrompt function for dynamic command prompts.
  • Added unit tests for the FormatPrompt function to ensure correctness.
  • Set the default command prompt to [datetime] [Qcounter] in the configuration store.

Implementation:

  • config/utils.go: Added FormatPrompt function to handle dynamic prompt formatting.
  • config/utils_test.go: Added unit tests for FormatPrompt.
  • cmd/chatgpt/main.go: Updated to use the FormatPrompt function.
  • config/store.go: Set the default command prompt to [datetime] [Qcounter].
  • README.md: Documented the new variables and updated the Table of Contents.

@kardolus kardolus force-pushed the variables-for-interactive-mode branch 2 times, most recently from 66aa1cb to 6472bfa Compare June 2, 2024 03:41
@kardolus kardolus force-pushed the variables-for-interactive-mode branch from 6472bfa to 96850d5 Compare June 2, 2024 03:43
@kardolus kardolus merged commit 4218ef9 into main Jun 2, 2024
10 checks passed
@kardolus kardolus deleted the variables-for-interactive-mode branch June 2, 2024 12:47
@catskull
Copy link
Collaborator

catskull commented Jun 2, 2024

Ah very cool! Was wondering how this would be handled in Go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants