-
Notifications
You must be signed in to change notification settings - Fork 2
OS X compatible #58
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
Open
yossi-dy
wants to merge
2
commits into
ramonsnir:master
Choose a base branch
from
yossi-dy:osx-compatible
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
OS X compatible #58
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| #!/bin/bash | ||
|
|
||
| COLOR_RED="$(tput setaf 1)" | ||
| COLOR_GREEN="$(tput setaf 2)" | ||
| COLOR_CLR="$(tput sgr0)" | ||
|
|
||
| if [ -t 1 -o "$DETOUL_COLOR_ALWAYS" == "1" ]; then | ||
| remove_colors="cat" | ||
| else | ||
|
|
@@ -108,7 +112,7 @@ save-spec() { | |
| stash | ||
| ( | ||
| git checkout detoul-spec && | ||
| (cat "$DETOUL_TMP/spec" | head -n -1 | grep -v "^$" > "$target" || [ 1 -eq 1 ]) && | ||
| (cat "$DETOUL_TMP/spec" | awk -v n=1 'NR>n{print line[NR%n]};{line[NR%n]=$0}' | grep -v "^$" > "$target" || [ 1 -eq 1 ]) && | ||
| cat "$DETOUL_TMP/spec" | tail -n 1 | tr -d '\n' >> "$target" && | ||
| git add "$target" && | ||
| git commit -m "$1" $commit_opts | ||
|
|
@@ -117,8 +121,6 @@ save-spec() { | |
| cd - >/dev/null | ||
| } | ||
|
|
||
| (( | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that's what you meant to do.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep :-) found it out last night. Will put those back in place. |
||
|
|
||
| if [ $# -lt 1 ]; then | ||
| help | ||
| fi | ||
|
|
@@ -286,7 +288,7 @@ save-spec() { | |
| case "$1" in | ||
| test) | ||
| git branch -D "$DETOUL_BRANCH" >/dev/null 2>&1 | ||
| echo -e "\e[32mIntegration branch succesfully created.\e[0m" | ||
| echo -e "${COLOR_GREEN}Integration branch succesfully created.${COLOR_CLR}" | ||
| ;; | ||
| make) | ||
| git checkout "$DETOUL_BRANCH" >/dev/null 2>&1 | ||
|
|
@@ -298,7 +300,7 @@ save-spec() { | |
| ;; | ||
| *) | ||
| git branch -D "$DETOUL_BRANCH" >/dev/null 2>&1 | ||
| echo -e "\e[31mUnknown operation '$1'.\e[0m" >&2 | ||
| echo -e "${COLOR_RED}Unknown operation '$1'.${COLOR_CLR}" >&2 | ||
| fail | ||
| esac | ||
| quit | ||
|
|
@@ -309,7 +311,7 @@ save-spec() { | |
| stash-pop | ||
| fi | ||
| git branch -D "$DETOUL_BRANCH" >/dev/null 2>&1 | ||
| echo -e "\e[31mFailure.\e[0m" >&2 | ||
| echo -e "${COLOR_RED}Failure.${COLOR_CLR}" >&2 | ||
| fail | ||
| fi | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't add awk as a dependency. Find an alternative solution.
Before it comes up: not python, node, ruby, php, or perl either. We have perl in colorize, but colorize isn't a core file (it can be skipped).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason for using awk as an alternative method was OSX's head command doesn't support negative values (so you can't exclude the last line, like you intended here).
Would you consider coreutils (https://www.gnu.org/software/coreutils/manual/html_node/head-invocation.html) as a polyfil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the problem, please find a solution that doesn't add awk (or another language) as a dependency.
If you can't find a different solution for Mac, you maybe can create create a new executable file here called
skip_last_lineor something that checks the OS, and if it's GNU head (head --version | head -n1 | grep -q GNU) uses head and otherwise uses awk.