Skip to content

Support for Go fmt-formatted strings #76

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

Merged
merged 1 commit into from
Jun 15, 2025
Merged

Conversation

vladimirvivien
Copy link
Owner

This PR implements fmt.Sprintf functionality for all gexe methods and functions that accept string parameters.

Changes:

  • Added variadic ...any parameters to all string-accepting methods on Session type
  • Added corresponding updates to all package-level functions
  • Maintained full backward compatibility

Fixes #70

@vladimirvivien vladimirvivien force-pushed the issue70/fmt_string branch 2 times, most recently from ea533fe to 6a9140e Compare June 15, 2025 15:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements support for Go's fmt.Sprintf formatting across all gexe string parameters while maintaining variable expansion and backward compatibility. Key changes include:

  • Adding variadic ...interface{} parameters to all string-accepting Session methods and package-level functions.
  • Applying go’s fmt.Sprintf formatting conditionally with the helper function applySprintfIfNeeded.
  • Updating tests and examples demonstrating sprintf formatting in various contexts.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
variables.go Updated Session methods (SetEnv, SetVar, Eval) to support formatting
str.go Updated String method to apply formatting
sprintf_*_test.go Added tests to verify sprintf functionality across platforms
sprintf_helpers.go Introduced helper functions for conditional formatting
procs.go, functions.go, filesys.go, echo.go Updated various process and file-related functions to support formatting
examples/sprintf_demo/* Demo application and documentation updated for sprintf support
README.md Enhanced description of sprintf formatting support in gexe
Comments suppressed due to low confidence (3)

variables.go:69

  • Update the function comment for Eval to mention the new 'args ...interface{}' parameter that allows sprintf formatting, ensuring consistency with the new API behavior.
func (e *Session) Eval(str string, args ...interface{}) string {

functions.go:60

  • Revise the documentation for the Eval function to explicitly mention that it now accepts variadic formatting arguments, complementing its variable expansion functionality.
func Eval(str string, args ...interface{}) string {

echo.go:47

  • Consider updating the ProgAvail comment to note that the function now supports additional variadic arguments for sprintf formatting.
func (e *Session) ProgAvail(progName string, args ...interface{}) string {

@vladimirvivien vladimirvivien merged commit a1bfa50 into main Jun 15, 2025
5 checks passed
@vladimirvivien vladimirvivien deleted the issue70/fmt_string branch June 15, 2025 17:20
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.

Support Go-formatted strings in gexe functions/methods
1 participant