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

Avoid add M exec-opt twice #412

Merged
merged 3 commits into from
May 27, 2022
Merged

Avoid add M exec-opt twice #412

merged 3 commits into from
May 27, 2022

Conversation

bootleq
Copy link
Contributor

@bootleq bootleq commented May 25, 2022

Hi, when using iced repl command,
sometimes I need to use different aliases with clj -M exec option,
for example iced repl -M:xx:yy:iced,
but it produces another -M in MAIN_FLAG handling and makes the prior no-effect.

This PR try to detect -M in command line options and avoid second -M as an fix.

If user explicitly specify `-M:xxx` option to e.g., add some aliases, we
should just take it instead of build second `-M` in MAIN_FLAG.
Copy link
Owner

@liquidz liquidz left a comment

Choose a reason for hiding this comment

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

@bootleq Thanks for your contribution!
Looks good to me, but just sorry, could you fix the following file instead of bin/iced ?

if [ "$(printf '%s\n' "$MIN_MAIN_VERSION" "$CLOJURE_CLI_VERSION" | sort -V | head -n1)" = "$MIN_MAIN_VERSION" ]; then
MAIN_FLAG="-M -m"
else
MAIN_FLAG="-m"
fi

bin/iced is generated by this template file via make bin command.
It may be good to add notes about this to the head of template file.

The `bin/iced` file is made (`make bin`) from this template.

Previous commit missed to update this source.
@bootleq
Copy link
Contributor Author

bootleq commented May 26, 2022

Hi, thanks for the reminder, I have changed the template, too.

Feel uncertain to add note to template, because someone didn't notice the file like me, will also overlook the note.

@liquidz
Copy link
Owner

liquidz commented May 26, 2022

@bootleq Thank you!

Feel uncertain to add note to template, because someone didn't notice the file like me, will also overlook the note.

If we add notes to the template and run make bin, bin/iced will also have same notes.

So it should help to avoid overlooking.

@bootleq
Copy link
Contributor Author

bootleq commented May 27, 2022

If we add notes to the template and run make bin, bin/iced will also have same notes.

So it should help to avoid overlooking.

Understand, how about this comment?

# This file is generated by `make bin`.

@liquidz
Copy link
Owner

liquidz commented May 27, 2022

It might be helpful to specify what action to take if someone want to make a change.
e.g.

# === WARNING ===
# bin/iced is generated by `make bin`.
# Please edit clj/template/iced.bash instead of bin/iced.

This would give further contributor a hint, must make change to
template.
@bootleq
Copy link
Contributor Author

bootleq commented May 27, 2022

Thanks, I have added the comment, hope further contributors will find those files were changed together.

Copy link
Owner

@liquidz liquidz left a comment

Choose a reason for hiding this comment

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

@bootleq Thank you so much! LGTM

@liquidz liquidz merged commit b3c8078 into liquidz:main May 27, 2022
@bootleq bootleq deleted the cli-M-opt branch May 27, 2022 12:08
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