Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

reformat-source script does not work on macOS #1286

Closed
e1528532 opened this issue Jan 21, 2017 · 2 comments
Closed

reformat-source script does not work on macOS #1286

e1528532 opened this issue Jan 21, 2017 · 2 comments
Assignees

Comments

@e1528532
Copy link
Contributor

Describe what you wanted to do

I wanted to format my c++ code for comitting and thus executed the reformat-source script on macOS from the libelektra root directory.

Describe what you expected

I expected that it will successfully reformat the sourcecode.

Describe what actually happened

First, clang-format-3.8 was missing, which i installed using homebrew "brew install clang-format". However, this provides the clang-format command, not clang-format-3.8, i simply changed the script locally for now, alternatively i could have made an alias for clang-format-3.8 to clang-format.

Then it complained that readlink does not support the -f option. The funny thing is that the man pages says it should support this option, but upon execution it tells you

readlink: illegal option -- f
usage: readlink [-n] [file ...]

I just stripped the option then it stopped complaining.

After these steps the script worked successfully and did reformat the code. Is there any way to make this work for both platforms, or would it be better to offer a slightly adjusted script for mac? Or is there another solution?

System Information

  • Elektra Version: master
  • clang-format
  • macOS Sierra
@markus2330
Copy link
Contributor

Thanks for reporting! I thought it works nicely thus @sanssecours was the one who initiated using clang-format after all and never complained ;)

clang-format should be simply to fix by detecting it with which. (Prefer -3.8 if available, otherwise use it without postfix, maybe with version check).

The -f option is used nearly everywhere, maybe we should have an include-common (like we have configure-common now) which fixes these incompatibilities and provides common functions/variables for shellscripts?

@sanssecours
Copy link
Member

I thought it works nicely thus @sanssecours was the one who initiated using clang-format after all and never complained ;)

As far as I can remember I never used reformat-source. I just use the ”Reformat Document” command of TextMate’s C-Bundle, which reformats the current file after you press Ctrl + + H.

This was referenced Jan 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants