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

Support prepend() #2045

Merged
merged 7 commits into from
May 17, 2024
Merged

Support prepend() #2045

merged 7 commits into from
May 17, 2024

Conversation

gyreas
Copy link
Contributor

@gyreas gyreas commented May 16, 2024

This PR adds a convenient prepend function.

prepend(prefix, base) takes a prefix and a base string with space-separated words,
and prepends prefix to the beginning of each word in the base string.

For example: prepend('src', 'foo bar baz') -> 'src/foo src/bar src/baz'

@casey
Copy link
Owner

casey commented May 17, 2024

Seems reasonable to me! How about calling it prepend, since that's shorter, and using split_whitespace instead of split(" ")?

@casey
Copy link
Owner

casey commented May 17, 2024

This should also be documented in the readme (along with addsuffix).

@gyreas
Copy link
Contributor Author

gyreas commented May 17, 2024

This should also be documented in the readme (along with addsuffix).

README? Ah! No wonder I feel something is still missing! Alright, I do that across the PRs. Thanks!

Seems reasonable to me! How about calling it prepend, since that's shorter, and using split_whitespace instead of split(" ")?

That's a shorter name, okay!

prepend(prefix, base) takes a `prefix` and a (possibly space-separated) `base` string,
and append `prefix` to the beginning of each word in the base string;
for example, prepend('src', 'foo bar baz') -> 'src/foo src/bar src/baz'
@gyreas gyreas changed the title Support addprefix() Support prepend() May 17, 2024
@casey casey enabled auto-merge (squash) May 17, 2024 23:21
@casey
Copy link
Owner

casey commented May 17, 2024

LGTM!

@casey casey merged commit 89ccf42 into casey:master May 17, 2024
5 checks passed
neunenak pushed a commit to neunenak/just that referenced this pull request May 18, 2024
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.

2 participants