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

NSF Grant #45

Open
wants to merge 218 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
da7accb
counts objects and says a description using osx say
Nov 18, 2017
1a5e1f7
pluralized names for each entry in pbtxt
Nov 19, 2017
e1f6be8
pandas in environment.yml
Nov 21, 2017
d525828
NUM_CLASSES 90 despite 80 COCO limit?
Nov 21, 2017
6b06d70
num classes
Nov 21, 2017
63dc5be
adjust threshold back up to .5 (two places)
Nov 28, 2017
4a138ca
object_detection/utils/visualization_utils.py is read only now and re…
Nov 28, 2017
6b0aaf4
new radar.py classes to hold radar data, WIP
Dec 5, 2017
16aeb53
Got rtsp streaming working
Dec 5, 2017
6118cdc
(Documentation)
Dec 5, 2017
662e0ae
- Strike through outdated readme notes.
Dec 5, 2017
aa6bfd7
standup notes
Dec 6, 2017
9cf7ce1
Merge branch 'master' of github.com:aira/object_detector_app
Dec 6, 2017
cfb3b89
updated standup
Dec 6, 2017
b7240be
(Jenkinsfile) Added dummy Jenkinsfile for CI (and later CD)
Dec 6, 2017
bf721ee
Merge branch 'master' of https://github.com/aira/object_detector_app
Dec 6, 2017
486fa93
- Minimized the environment file (maybe it could be smaller)
Dec 6, 2017
2ca3e74
- Minimized the environment file (maybe it could be smaller)
Dec 6, 2017
1dd7405
- Minimized the environment file (maybe it could be smaller)
Dec 7, 2017
07eb83f
Setting up Jenkins Pipeline in Blue Ocean.
alxmrs Dec 7, 2017
1a8d688
Trying to make subsequent commands run inside docker container.
alxmrs Dec 7, 2017
ed013b4
- Moved `build` and `test` commands to bash scripts
Dec 7, 2017
c7690e1
Merge branch 'master' of https://github.com/aira/object_detector_app …
Dec 7, 2017
c360f13
Merge pull request #1 from aira/feature/jenkins
alxmrs Dec 7, 2017
1098090
- Dev tested + modified Jenkinsfile
Dec 8, 2017
9219025
Merge pull request #2 from aira/feature/jenkins
alxmrs Dec 8, 2017
3411ea5
- Changed `sh` --> `bash` in Jenkinsfile
Dec 8, 2017
661430c
Trying to get jenkinsfile to run without error.
Dec 8, 2017
a4e2cce
- Testing out method to get the conda env working in Jenkins
Dec 8, 2017
5d5dffd
Modified Jenkinsfile to work with local conda installation in Jenkins…
Dec 8, 2017
c8ab7df
- Fixed groovy syntax error
Dec 8, 2017
04fc0e4
Modified Jenkinsfile
Dec 8, 2017
e2beb26
- Changing volume mapping rw access to default
Dec 8, 2017
7ed0399
- Mapping two new volumes (`/etc/passwd` and `/etc/group`) to docker …
Dec 8, 2017
d995836
- Mapping two new volumes (`/etc/passwd` and `/etc/group`) to docker …
Dec 8, 2017
8d52c54
- Adding USERID env variable
Dec 8, 2017
9de20dd
- added conda info, going to see what's happening on Jenkins/docker i…
Dec 8, 2017
1323478
- added conda info, going to see what's happening on Jenkins/docker i…
Dec 8, 2017
da6069b
- added conda info, going to see what's happening on Jenkins/docker i…
Dec 8, 2017
5c13e36
- needed to pass a flag to `conda clean`. Passing all argument
Dec 8, 2017
3637163
- Attempting to run pipeline without docker.
Dec 8, 2017
da3c492
- Blindly attempting to elevate privledges with `sudo`
Dec 8, 2017
0b30da4
- Stepping back on specifing the env. Changed permissions for the `co…
Dec 8, 2017
f536bab
- Copying example jenkins file more closely.
Dec 8, 2017
9f4dda4
Changed env variables (uid, gid)
Dec 8, 2017
a31d3b7
Changed env variables (uid, gid)
Dec 8, 2017
0b9f169
getting info about pkgs dir
Dec 9, 2017
8da58ce
Experimenting
Dec 9, 2017
2206920
(CICD)
Dec 11, 2017
06b66ed
(Fix Unit Tests)
Dec 11, 2017
363d7dd
(Unit Test, Removed unused Files)
Dec 11, 2017
cf0d536
(CICD)
Dec 11, 2017
f65c458
- In Jenkinsfile, commented out deploy stubs.
Dec 12, 2017
ec88292
standup-notes
Dec 12, 2017
e9bc312
Merge branch 'master' of github.com:aira/object_detector_app
Dec 12, 2017
99d5c67
- Createds script to install tensorflow `nets` library (i.e. clone th…
Dec 12, 2017
23c2b67
- Removed `imshow` commands. Running headless by default.
Dec 12, 2017
9787879
- Changed argparser action, simpler interface (thanks Hobson)
Dec 12, 2017
bc7ed88
Merge pull request #4 from aira/feature/headless
hobson Dec 12, 2017
f864d01
- Refactored NLP as python package
Dec 12, 2017
113a3ad
- Moved NLP module to top level (outside of `object_detection`
Dec 12, 2017
ee3af45
- Refactored Voice output to be defaulted to off. Can be set on with …
Dec 12, 2017
74cfdf3
image datasets
Dec 12, 2017
da31d5a
ignore tf model files
Dec 12, 2017
b09a803
(MQTT Layer)
Dec 12, 2017
c667eed
(Bugfix: package/script conflict)
Dec 12, 2017
904692f
(NLP Reorg)
Dec 12, 2017
399f15e
(Dispatch Org)
Dec 12, 2017
07a5879
(Moved back `radar.py`)
Dec 12, 2017
983d8c7
Merge branch 'master' of github.com:aira/object_detector_app
Dec 13, 2017
dfe0479
__file__ instead of cwd()
Dec 13, 2017
10d2a02
(Working Demo)
Dec 13, 2017
779b3ed
(Refactor NLP Organization)
Dec 13, 2017
9513e45
Merge pull request #5 from aira/feature/nlp
hobson Dec 13, 2017
7ad16cb
(Unit Test Fixes)
Dec 13, 2017
c740bea
Merge branch 'master' of https://github.com/aira/object_detector_app
Dec 13, 2017
7b6440b
Revert "(Unit Test Fixes)"
Dec 13, 2017
00170a0
dict to list mapping pairs
Dec 13, 2017
4408b67
Merge branch 'master' of github.com:aira/object_detector_app into radar
Dec 13, 2017
8f28b70
(README update)
Dec 13, 2017
b58fcca
Notes from API Review
alxmrs Dec 13, 2017
3d98224
Cleaned up notes from API Discussion
alxmrs Dec 13, 2017
98d49e8
ignore tmp files, minimal klugie radar (just pasthrough to update_state)
Dec 13, 2017
de2c39d
merge conflict on .gitignore
Dec 13, 2017
25a880d
just try to import
Dec 14, 2017
79b8da8
one level up
Dec 14, 2017
6f7c8a4
incorporate new constants file into object_detection_app
Dec 14, 2017
578c250
object_detection_app.py
Dec 14, 2017
c601ef5
merge working tmp from master
Dec 14, 2017
c24d5a0
(Color Labeling Package)
Dec 14, 2017
b793b58
(Histogram approach)
Dec 14, 2017
6b982bc
found it!
Dec 14, 2017
e22274a
updated readme file
Dec 14, 2017
b8b9d71
Readme Numbers updated
Dec 14, 2017
dcd1780
Update README.md
ashwinkannan94 Dec 14, 2017
30ba21e
Update README.md
ashwinkannan94 Dec 14, 2017
ce21d77
Update README.md
ashwinkannan94 Dec 14, 2017
2c5f580
Up to date with master
Dec 14, 2017
ccf61f1
style guide and bugfix by Ashwin
Dec 14, 2017
76882f5
style guide and bugfix by Ashwin
Dec 14, 2017
a6998da
(Color Hist v1)
Dec 15, 2017
0a8d879
constants for color and bb
Dec 15, 2017
305a109
Merge branch 'master' of github.com:aira/object_detector_app into Ashwin
Dec 15, 2017
172082d
docstring
Dec 15, 2017
7bbd878
code added
Dec 15, 2017
2a2563e
updated test cases and code
Dec 15, 2017
3c4460b
changed print to return.
Dec 15, 2017
d477251
updated testdoc with complete suite of test cases
Dec 15, 2017
2b68790
NSF-4 #start-progress add style guide and constants for vector
Dec 15, 2017
2f2baa6
Merge branch 'master' of github.com:aira/object_detector_app
Dec 15, 2017
a67b6dd
(Update State Vector)
Dec 15, 2017
45ceec2
add constants
Dec 15, 2017
9ee4e50
(Color Labeler Module)
Dec 15, 2017
a8b7cfa
new transformation file which contains normalization and labeling whe…
Dec 15, 2017
bd3c1ae
Merge branch 'master' into radar
Dec 15, 2017
00066ba
modified file. No longer need to use. All under NLP branch and filena…
Dec 15, 2017
e454eb8
style guide
Dec 15, 2017
6e6e2d8
removed the normalize.py file from repo
Dec 15, 2017
4abda2b
Code that ran during the demo
Dec 15, 2017
c858092
API Conversation 2
alxmrs Dec 16, 2017
c3549e8
Fine Tuning Readme
alxmrs Dec 16, 2017
1573024
Merge pull request #8 from aira/readme-api-discussion
alxmrs Dec 16, 2017
2d2bbad
- Added names to string templates.
Dec 16, 2017
1a2ce9e
- Now we can communicate with the dash + android device
Dec 16, 2017
48c4cb6
Merge pull request #9 from aira/feature/color-hist
alxmrs Dec 16, 2017
7b2f4e8
(Updated README)
alxmrs Dec 16, 2017
6d778b0
Merge branch 'master' into radar
hobson Dec 16, 2017
b19c4ae
Merge pull request #6 from aira/radar
hobson Dec 16, 2017
b7f6675
object_vectors is a list of lists
Dec 17, 2017
f3d2141
updated to coding standards and changed all tabs to 4 spaces.
Dec 18, 2017
98498e3
changed print to return
Dec 18, 2017
f6bd531
add singulars to plurals.py
Dec 18, 2017
cb503cd
no more utterance_frames arg
Dec 18, 2017
17486ee
fixed say error handling (os.system doesn't raise exceptions)
Dec 18, 2017
e8ee0f5
Merge pull request #10 from aira/feature/db
hobson Dec 18, 2017
95f6c96
(NLP Functions)
Dec 18, 2017
77989c8
Revert "(NLP Functions) - Added template string to `Describe` command…
Dec 18, 2017
39b19fd
Merge branch 'master' of https://github.com/aira/object_detector_app
Dec 18, 2017
4e38dcc
fixed PR changes.
Dec 18, 2017
dc4460b
(Merges from Hobbs PR)
Dec 18, 2017
be4052c
- `nlp/core.py` doctests now pass
Dec 18, 2017
09b84ff
Merge branch 'master' of https://github.com/aira/object_detector_app …
Dec 18, 2017
6d16736
style changes for docstring and doctest
Dec 18, 2017
7bd3dcb
Update README.md
hobson Dec 18, 2017
e7357d8
Got it (mostly) working.
Dec 19, 2017
3a7f4ef
(NLP Doctests passing)
Dec 19, 2017
685e78b
- Doctests passing for `include_color` parameter.
Dec 19, 2017
017128c
changed output state vector to have location
Dec 19, 2017
de17a4a
added a estimate function to take in the box args and output that as …
Dec 19, 2017
d928c0d
Merge branch 'master' of https://github.com/aira/object_detector_app …
Dec 19, 2017
60621d8
Merge branch 'master' of https://github.com/aira/object_detector_app …
Dec 19, 2017
3e169c2
- Tests passing
Dec 19, 2017
27d468f
- Tests passing
Dec 19, 2017
93d7ed1
- wrote more doctests to test differentiation in aggregation.
Dec 19, 2017
212b13e
no same variable names and all docstring plus doctests updated
Dec 19, 2017
1366d0d
minor changes
Dec 19, 2017
6d19fd1
no variables have the same name
Dec 19, 2017
8460c1d
- doctested `include_color` and `include_position` and tests all pass
Dec 19, 2017
7b904e3
(Fixed position bugs)
Dec 19, 2017
593a6f5
- Cleaned up the `describe.py` file/command.
Dec 19, 2017
d53767d
Redone the variable names to be correct
Dec 19, 2017
72fcdef
changed variable name to not be conflicting with function name
Dec 19, 2017
0a9bbb9
(Deployment)
Dec 19, 2017
b21d7ca
removed loc variable
Dec 19, 2017
8166ad8
(Merge with Ashwin's PR)
Dec 19, 2017
9a1f786
Merge branch 'Ashwin' of https://github.com/aira/object_detector_app …
Dec 19, 2017
146a62d
- renamed Describe --> DescribeScene
Dec 19, 2017
6ff9183
- Fixed color command
Dec 19, 2017
4631c86
Merge pull request #12 from aira/Ashwin
alxmrs Dec 19, 2017
cb22f4a
Merge branch 'master' of https://github.com/aira/object_detector_app …
Dec 19, 2017
e8210d1
Revert "(Deployment)"
Dec 19, 2017
e02a0d1
(Deployment start)
Dec 19, 2017
1670c0e
Merge branch 'master' of https://github.com/aira/object_detector_app …
Dec 19, 2017
7cb26b8
Merge branch 'master' of https://github.com/aira/object_detector_app
Dec 19, 2017
2ed2c90
Merge pull request #13 from aira/feature/nlp
hobson Dec 19, 2017
11ac8ae
(Creating Deploy Scripts)
Dec 19, 2017
28089d6
(Merge with Master)
Dec 19, 2017
efbb325
(Creating Deploy Scripts)
Dec 19, 2017
8193982
(gitignoring log)
Dec 19, 2017
36087e4
(gitignoring process id log)
Dec 19, 2017
b2555fc
(Merge with Master)
Dec 19, 2017
355cca2
- Added shutdown script
Dec 19, 2017
209fc8a
(Revering weird merge change)
Dec 19, 2017
4ef1f52
Merge pull request #14 from aira/feature/deploy
hobson Dec 19, 2017
b4de378
Merge branch 'master' of https://github.com/aira/object_detector_app
Dec 19, 2017
89f072e
Update CONTRIBUTING.md
hobson Dec 20, 2017
35a2bd3
Update CONTRIBUTING.md
hobson Dec 20, 2017
b36f946
get rid of the annoying red json comment highlighting
hobson Dec 20, 2017
b1b8941
indent
hobson Dec 20, 2017
e7ddfe0
Update README.md
hobson Dec 20, 2017
98bbf5a
Update README.md
hobson Dec 20, 2017
547f0a9
Update README.md
hobson Dec 20, 2017
5a9c520
Update README.md
hobson Dec 20, 2017
c3b3505
Update README.md
hobson Dec 20, 2017
7323eac
mqtt fixes
Dec 20, 2017
e174a3e
fixes to make the server run the shell scripts properly as paths need…
Dec 20, 2017
866df19
simple fix.
Dec 21, 2017
f65c108
revert path
Dec 21, 2017
46c892b
Merge pull request #16 from aira/mqtt_fixes
hobson Dec 21, 2017
422ba01
Merge pull request #17 from aira/mqtt_fixes_2
hobson Dec 21, 2017
0125a1e
basic JSON format being output. Need to change the confidence parameter
Dec 21, 2017
0380176
fixed messageId to be incremented each time send() is called. Made th…
Dec 21, 2017
8ccc4eb
Merge branch 'master' of https://github.com/aira/object_detector_app
Dec 27, 2017
8f6df5b
(Fixed CONTRIBUTING.md minor error)
Dec 27, 2017
966f050
milliseconds fix and command changed to statement
Dec 27, 2017
b3eb646
- Fixed bug, need to refactor.
Dec 27, 2017
ae78e92
- Added `loop_stop` to stop the mqtt client before the python program…
Dec 27, 2017
d2c7c8c
Merge pull request #18 from aira/json_payload_fix
alxmrs Dec 27, 2017
c8b0496
Revert "- Added `loop_stop` to stop the mqtt client before the python…
Dec 27, 2017
d5743e5
Merge branch 'master' of https://github.com/aira/object_detector_app …
Dec 27, 2017
f0834e6
(Threading potential fixes)
Dec 27, 2017
cf90269
(Dev test main while loop)
Dec 27, 2017
1cb274c
Revert "(Threading potential fixes)"
Dec 27, 2017
a6ec827
Hard Revert "(Threading potential fixes)"
Dec 28, 2017
773ff54
(MQTT loop fix)
Dec 28, 2017
ce7513a
(Null Check Frame)
Dec 28, 2017
5e40948
Merge pull request #19 from aira/bugfix/video404
alxmrs Dec 28, 2017
30185b7
NSF science contribution docs
hobson Apr 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ downloads/
eggs/
.eggs/
lib/
lib64/
lib64
parts/
sdist/
var/
Expand Down Expand Up @@ -89,4 +89,20 @@ ENV/
.ropeproject

# Custom
.idea/
.idea/
log.txt
pids.txt

# tensorflow model weights
*.tar.gz

*.dev.*
*.master.*
*.bak.*
*.broke.*
*.fixed.*
*.works.*

# Mac OSX
.DS_Store

76 changes: 76 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
## Style Guide

The primary goal is to produce readable code.
This means being consistent with patterns and style prefered by most python developers at corporations that build great stuff with python.


### [PEP8](https://www.python.org/dev/peps/pep-0008/) with these exceptions

Follow the [Hettinger interpretation of PEP8](https://www.youtube.com/watch?v=wf-BqAjZb8M) for beautiful, readable code.

* max line length is "about" 120 chars (if you go a little over, don't worry about it)
* max complexity: "mccabe_threshold": 12, # McCabe complexity checker limits the number of conditional branches
* type hints are a good idea on conditional branches that are rarely run, but duck-typing is preferred for mainline code

Here's my Sublime Anaconda plugin configuration.


```javascript
{
// Maximum McCabe complexity (number of conditional branches within a function).
"mccabe_threshold": 7,

// Maximum line length
"pep8_max_line_length": 120
}
```


### Documentation

Markdown README.md files in any folder containing significant code.

Use [Google/Numpy/Napolean/Markdown](http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) docstring syntax, **not** the original ReST dosctring format.


#### Example Dosstring


```python
def add(value, num=0):
""" Add a float to an integer

Args:
value (float): first number in the sum
num (int): the integer to be added

Returns:
float: the sum of `value + num`

>>> add(1., 2)
3.0
"""
pass
```


### Workflow

#### Branch off master

whenever you begin a new feature/task:

`git checkout master -b feature/my-awesome-new-feature`

#### Commit often

Mentioning the Jira ticket number in your, brief, active verb-tense comment (message)

`git commit -am 'NSF-4 #start-review integrate location into description'`

#### Transition your Jira Tickets

Whenever you can, so save yourself the Jira GUI shuffle. But send it to "#start-review" (the QA stage) rather than #done:

`git commit -am 'NSF-4 #start-review add color vectors'`

114 changes: 114 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/usr/bin/env groovy

pipeline {

/* Create instance (Agent) to run Jenkins pipeline on

Section creates a docker container with anaconda installed on it for jenkins pipeline to run on. Arguments work
as follows:
`-u 0` user ID, which has root value. Good reference about docker UID/GIDs (https://goo.gl/bYFxVh)
`--rm` If a docker container with the same name already exists, remove it
`--name ai-conda` Give this docker instance the name `ai-conda`
`-v _:_` map volumes. Specifically, map `passwd`, `group` and the conda packages volumes to the container
*/
agent {
docker {
image 'continuumio/miniconda3'
args '-u 0 --rm --name ai-conda -v /etc/passwd:/etc/passwd -v /etc/group:/etc/group -v /home/jenkins/.conda3/pkgs:/home/jenkins/.conda/pkgs:rw,z'
}
}

stages {
stage('Checkout') {
steps {
checkout scm
}
}

stage('Test') {
environment {
CONDA_ENV = "${env.WORKSPACE}/test/${env.STAGE_NAME}"
}
steps {
/* Recreate a conda environment from the config file

`-q` quite mode. Remove to see verbose output
`--force` remove previously existing environment of the same name
`-f FILE` environment definition file
`-p PATH` Full path to environment prefix (replacing default)
*/
sh 'conda env create -q --force -f environment.yml -p $CONDA_ENV'

/* Activate the environment and run unit tests

`source ...` activate the environment
`python -m pytest` run `pytest` as a module
`python -m unittest...` run `unittest` on the `object_detection` directory, pattern matching all of
the files that end in `_test.py`

*/
sh '''#!/bin/bash -ex
source $CONDA_ENV/bin/activate $CONDA_ENV
python -m pytest
python -m unittest discover -s object_detection -p "*_test.py"
'''

}
}

/*
stage('Deploy - Staging'){
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
echo 'Placeholder: Deploying to staging/dev'
}
}

stage('Sanity check') {
steps {
input "Does the staging env look good? Good enough to deploy into production?"
}
}

stage('Deploy - Production') {
steps {
echo 'Placeholder: Deploying to prod'
}
}
*/
}

/* TODO(Alex): Fix Slack Notifications. */
post {
always {
echo 'The job has finished.'
slackSend channel: '#ai-nsf-jenkins-jobs',
color: 'good',
message: "The pipeline ${currentBuild.fillDisplayName} completed."
}
success {
slackSend channel: '#ai-nsf-jenkins-jobs',
color: 'good',
message: "The pipeline ${currentBuild.fillDisplayName} completed successfully."
}
unstable {
slackSend channel: '#ai-nsf-jenkins-jobs',
color: 'warning',
message: "The pipeline ${currentBuild.fillDisplayName} is unstable. Check it out here: ${env.BUILD_URL}"
}
failure {
slackSend channel: '#ai-nsf-jenkins-jobs',
color: 'danger',
message: "@all The pipeline ${currentBuild.fillDisplayName} has failed! Check it out here: ${env.BUILD_URL}"
}
/*
changed {

}
*/
}
}
112 changes: 112 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
.PHONY: clean lint build

#################################################################################
# GLOBALS #
#################################################################################


PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
PROJECT_NAME = object-detection
PYTHON_INTERPRETER = python

ifeq (,$(shell which conda))
HAS_CONDA=False
else
HAS_CONDA=True
endif


#################################################################################
# COMMANDS #
#################################################################################

## Delete all compiled Python files
clean:
find . -name "*.pyc" -exec rm {} \;

## Lint using flake8
lint:
$(PYTHON_INTERPRETER) -m flake8 --exclude=lib/,bin/,docs/conf.py --ignore F401,H301,E203,E241 .

## Set up python interpreter environment
create_env:
ifeq (True,$(HAS_CONDA))
@echo ">>> Detected conda, creating conda environment."
conda env create -f environment.yml
@echo ">>> New conda env created. Activate with:\nsource activate $(PROJECT_NAME)"
else
@echo "Error: Install conda"
endif

delete_env:
conda env remove -y -n object-detection


## Build (Get interpreter running)
## TODO

## Run project tests
test:
pytest -vs utils/
$(PYTHON_INTERPRETER) -m unittest discover -s object_detection -p "*_test.py"

#################################################################################
# Self Documenting Commands #
#################################################################################

.DEFAULT_GOAL := show-help

# Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
# sed script explained:
# /^##/:
# * save line in hold space
# * purge line
# * Loop:
# * append newline + line to hold space
# * go to next line
# * if line starts with doc comment, strip comment character off and loop
# * remove target prerequisites
# * append hold space (+ newline) to line
# * replace newline plus comments by `---`
# * print line
# Separate expressions are necessary because labels cannot be delimited by
# semicolon; see <http://stackoverflow.com/a/11799865/1968>
.PHONY: show-help
show-help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
@echo
@sed -n -e "/^## / { \
h; \
s/.*//; \
:doc" \
-e "H; \
n; \
s/^## //; \
t doc" \
-e "s/:.*//; \
G; \
s/\\n## /---/; \
s/\\n/ /g; \
p; \
}" ${MAKEFILE_LIST} \
| LC_ALL='C' sort --ignore-case \
| awk -F '---' \
-v ncol=$$(tput cols) \
-v indent=19 \
-v col_on="$$(tput setaf 6)" \
-v col_off="$$(tput sgr0)" \
'{ \
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
n = split($$2, words, " "); \
line_length = ncol - indent; \
for (i = 1; i <= n; i++) { \
line_length -= length(words[i]) + 1; \
if (line_length <= 0) { \
line_length = ncol - indent - length(words[i]) - 1; \
printf "\n%*s ", -indent, " "; \
} \
printf "%s ", words[i]; \
} \
printf "\n"; \
}' \
| more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')
Loading