question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for variable interpolation in message strings.

See original GitHub issue

Similar in spirit to ${DEFAULT-VALUE} and ${COMPLETION-CANDIDATES}, it would be very useful to allow a set of variables to be registered that could then be used in message strings.

For example, currently I need to do this on my command methods in a hierarchy:

@Override
@Command(description = "Tails the " + App.SERVICE + " docker logs")
public Status logs() {
    return super.logs();
}

what would be nicer is:

@Command(description = "Tails the ${PARENT-COMMAND-NAME} docker logs")
public Status logs() {
  // ...
}

This would allow inheritance chains to allow for encapsulating command methods in the base class and thus the need to override just to change the variable value statically.

It would be nice to have some predefined variables for common things like parent command name and current command name, as well as the ability to generalize to support this use case and others.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:25 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
remkopcommented, Apr 18, 2019

See draft release notes for details.

0reactions
bobtiernay-oktacommented, Apr 18, 2019

Very nice work on this, and much appreciated! Will be certain to give feedback as time affords.

Read more comments on GitHub >

github_iconTop Results From Across the Web

string interpolation - format string output - Microsoft Learn
To concatenate multiple interpolated strings, add the $ special character to each string literal. The expression that produces a result to be ...
Read more >
String Interpolation in JavaScript - Dmitri Pavlutin
String interpolation is replacing placeholders with values in a string literal. The string interpolation in JavaScript is performed by ...
Read more >
Java Program to Illustrate String Interpolation - GeeksforGeeks
String Interpolation is a process in which the placeholder characters are replaced with the variables (or strings in this case) which allow ...
Read more >
String Interpolation in Java | Baeldung
String interpolation is a straightforward and precise way to inject variable values into a string. It allows users to embed variable ...
Read more >
Add support for variables in plugins | Grafana documentation
Grafana provides a couple of helper functions to interpolate variables in a string template. Let's see how you can use them in your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found