diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-03-30 13:51:51 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-04-02 16:16:01 +0900 |
commit | 008f34053c87650c83946874980fa97179267149 (patch) | |
tree | 436e7a1a0eb4208a845b9bc710253af16e344f15 /tools | |
parent | 79d264bfb008370a6af7ff42dc3962d0bf1ddf63 (diff) |
*.md: Improvements for markdownlint
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/completion/README.md | 165 | ||||
-rw-r--r-- | tools/route-server/README.md | 49 | ||||
-rw-r--r-- | tools/spell-check/README.md | 6 |
3 files changed, 122 insertions, 98 deletions
diff --git a/tools/completion/README.md b/tools/completion/README.md index f33965e9..38193bc6 100644 --- a/tools/completion/README.md +++ b/tools/completion/README.md @@ -10,81 +10,93 @@ The described how to use and how to customize of bash completion. 1. install bash-completion as follows: - ``` - % sudo apt-get install bash-completion - ``` + ```bash + % sudo apt-get install bash-completion + ``` 1. add gobgp's path to PATH environment variable - If you run 'go get github.com/osrg/gobgp/gobgp', gobgp command is installed in $GOPATH/bin. - ``` - % export PATH=$PATH:$GOPATH/bin - ``` + If you run 'go get github.com/osrg/gobgp/gobgp', gobgp command is installed + in $GOPATH/bin. + + ```bash + % export PATH=$PATH:$GOPATH/bin + ``` 1. load completion file - ``` - % source $GOPATH/src/github.com/osrg/gobgp/tools/completion/gobgp-completion.bash - ``` + ```bash + % source $GOPATH/src/github.com/osrg/gobgp/tools/completion/gobgp-completion.bash + ``` You can use tab completion for gobgp after loading gobgp-completion.bash. ### How to customize - In order to customize the bash completion, please follow steps below: + +In order to customize the bash completion, please follow steps below: 1. generate bash completion file - Generate the bash completion file by using binary of gobgp client. - This generating function uses [cobra bash completion](https://github.com/spf13/cobra#generating-bash-completions-for-your-command) internally. - ``` - % gobgp --gen-cmpl --bash-cmpl-file=<specifying a file name> - ``` - - The following function is generated if added the "gobgp neighbor" command to gobgp client. - - ``` - _gobgp_neighbor() - { - last_command="gobgp_neighbor" - commands=() - - flags=() - two_word_flags=() - flags_with_completion=() - flags_completion=() - - flags+=("--bash-cmpl-file=") - flags+=("--debug") - flags+=("-d") - flags+=("--gen-cmpl") - flags+=("-c") - flags+=("--host=") - two_word_flags+=("-u") - flags+=("--json") - flags+=("-j") - flags+=("--port=") - two_word_flags+=("-p") - flags+=("--quiet") - flags+=("-q") - - must_have_one_flag=() - must_have_one_noun=() - } - ``` + Generate the bash completion file by using binary of gobgp client. + This generating function uses + [cobra bash completion](https://github.com/spf13/cobra#generating-bash-completions-for-your-command) + internally. + + ```bash + % gobgp --gen-cmpl --bash-cmpl-file=<specifying a file name> + ``` + + The following function is generated if added the "gobgp neighbor" command + to gobgp client. + + ```bash + _gobgp_neighbor() + { + last_command="gobgp_neighbor" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--bash-cmpl-file=") + flags+=("--debug") + flags+=("-d") + flags+=("--gen-cmpl") + flags+=("-c") + flags+=("--host=") + two_word_flags+=("-u") + flags+=("--json") + flags+=("-j") + flags+=("--port=") + two_word_flags+=("-p") + flags+=("--quiet") + flags+=("-q") + + must_have_one_flag=() + must_have_one_noun=() + } + ``` 1. copy the generated functions - Copy the above function to **gogbp-static-completion.bash**. + Copy the above function to **gogbp-static-completion.bash**. 1. implement a dynamic completion - If you want to add dynamic completion, you need to implement that part yourself. - For example, if you want to add the neighbor address after the "gobgp neighbor" command dynamically, you can achieve it by implementing the specific internal command in **gobgp-dynamic-completion.bash**. + If you want to add dynamic completion, you need to implement that part + yourself. + For example, if you want to add the neighbor address after the "gobgp + neighbor" command dynamically, you can achieve it by implementing the + specific internal command in **gobgp-dynamic-completion.bash**. - 1. implement command to get a list of the neighbor address +1. implement command to get a list of the neighbor address - You need to add the processing function of the following like below to **gobgp-dynamic-completion.bash**. - ``` + You need to add the processing function of the following like below to + **gobgp-dynamic-completion.bash**. + + ```bash # Get bgp neighbors by using gobgp command. __gobgp_q_neighbor() { @@ -102,10 +114,12 @@ You can use tab completion for gobgp after loading gobgp-completion.bash. } ``` - 1. add a call to "__gobgp_q_neighbor" +1. add a call to "__gobgp_q_neighbor" - You can call the above functions by implementing as follows to **gobgp-static-completion.bash**: - ``` + You can call the above functions by implementing as follows to + **gobgp-static-completion.bash**: + + ```bash _gobgp_neighbor() { last_command="gobgp_neighbor" @@ -138,11 +152,14 @@ You can use tab completion for gobgp after loading gobgp-completion.bash. } ``` - 1. implement the handle processing +1. implement the handle processing - If you want to add the completion following the "gobgp neighbor \<neighbor address\>" command, you need to add a handler for _gobgp_neighbor_addr() like below to "__handle_gobgp_command()" function in **gobgp-dynamic-completion.bash**. + If you want to add the completion following the "gobgp neighbor \<neighbor + address\>" command, you need to add a handler for _gobgp_neighbor_addr() + like below to "__handle_gobgp_command()" function in + **gobgp-dynamic-completion.bash**. - ``` + ```bash case "${last_command}" in # Control after dynamic completion of bgp neighbor command gobgp_neighbor ) @@ -151,9 +168,13 @@ You can use tab completion for gobgp after loading gobgp-completion.bash. esac ``` - "next_command" variable above indicates a function to be called after "gobgp neighbor", and the function name of next command is supposed to be "_gobgp_neighbor_addr" in the example above. - Therefore the actual "gobgp_neighbor_addr" function needs to be implemented in **gobgp-dynamic-completion.bash**. - ``` + "next_command" variable above indicates a function to be called after + "gobgp neighbor", and the function name of next command is supposed to be + "_gobgp_neighbor_addr" in the example above. + Therefore the actual "gobgp_neighbor_addr" function needs to be + implemented in **gobgp-dynamic-completion.bash**. + + ```bash _gobgp_neighbor_addr() { last_command="gobgp_neighbor_addr" @@ -205,15 +226,15 @@ The described how to use of bash completion. ### How to use -zsh completion for gobgp works by adding the path of gobgp zsh completion directory to $fpath and enabling zsh completion like below: - - ``` - % vi ~/.zshrc +zsh completion for gobgp works by adding the path of gobgp zsh completion +directory to $fpath and enabling zsh completion like below: - GOBGP_COMP=$GOPATH/src/github.com/osrg/gobgp/tools/completion/zsh - fpath=($GOBGP_COMP $fpath) +```bash +% vi ~/.zshrc - autoload -Uz compinit - compinit +GOBGP_COMP=$GOPATH/src/github.com/osrg/gobgp/tools/completion/zsh +fpath=($GOBGP_COMP $fpath) - ```
\ No newline at end of file +autoload -Uz compinit +compinit +```
\ No newline at end of file diff --git a/tools/route-server/README.md b/tools/route-server/README.md index 6f58b776..1940551e 100644 --- a/tools/route-server/README.md +++ b/tools/route-server/README.md @@ -1,25 +1,25 @@ -Route Server testing env -======================== +# Route Server testing env + +## Preparation -Preparation ------------ Set up Ubuntu 14.04 Server Edition Virtual Machine environment. We tested this with Fusion on Mac OS X and VirtualBox on Windows 8. -Setup ------ +## Setup + Open a terminal and execute the following commands: -``` +```bash % sudo apt-get install -y --force-yes wget % wget https://raw.githubusercontent.com/osrg/gobgp/master/tools/route-server/route-server-docker.sh % chmod +x route-server-docker.sh % ./route-server-docker.sh install ``` -All necessary software will be installed. You can find all configuration files (for Quagga and gobgp) at /usr/local/gobgp. Let's make sure: +All necessary software will be installed. You can find all configuration files +(for Quagga and gobgp) at /usr/local/gobgp. Let's make sure: -``` +```bash fujita@ubuntu:~$ find /usr/local/gobgp|sort /usr/local/gobgp /usr/local/gobgp/gobgpd.conf @@ -41,28 +41,30 @@ fujita@ubuntu:~$ find /usr/local/gobgp|sort /usr/local/gobgp/q8/bgpd.conf ``` -Before going to playing with this environment, you need to log out and log in again. +Before going to playing with this environment, you need to log out and log in +again. -Start ------ -``` +## Start + +```bash % ./route-server-docker.sh start ``` + Eight containers for Quagga and one container for gobgp started. Now ready to start gobgp so let's go into the container for gobgp: -``` +```bash % docker exec -it gobgp bash ``` You are supposed to get a console like the following: -``` +```bash root@ec36881de971:~# ``` -``` +```bash root@e7cb66415e2f:~# go run gobgp/bgpd.go -f /mnt/gobgpd.conf INFO[0000] Peer 10.0.0.1 is added INFO[0000] Peer 10.0.0.2 is added @@ -71,7 +73,7 @@ INFO[0000] Peer 10.0.0.4 is added INFO[0000] Peer 10.0.0.5 is added INFO[0000] Peer 10.0.0.6 is added INFO[0000] Peer 10.0.0.7 is added -INFO[0000] Peer 10.0.0.8 is added +INFO[0000] Peer 10.0.0.8 is added ``` After some time, you'll see more messages on the console (it means @@ -79,13 +81,13 @@ Quagga bgpd connected to gobgp). On a different console, let's check the status of Quagga. -``` +```bash % docker exec -it q1 bash ``` You can do something like: -``` +```bash root@a40ac8058ca7:/# telnet localhost bgpd ``` @@ -95,12 +97,13 @@ The names of Quagga containers are q1, q2, q3, q4, q5, q6, q7, and q8 respectively. You can execute bash on any container with 'docker exec' command. -Stop ----- +## Stop + The following command stops and cleans up everything. -``` +```bash % ./route-server-docker.sh stop ``` -You can safely excute this command whenever something goes wrong and start again. +You can safely execute this command whenever something goes wrong and start +again. diff --git a/tools/spell-check/README.md b/tools/spell-check/README.md index 2b2800a6..299755ea 100644 --- a/tools/spell-check/README.md +++ b/tools/spell-check/README.md @@ -1,11 +1,11 @@ -# What's this? +# What's this This script is a spell checker for GoBGP's source codes. ## Requirements - [scspell3k](https://pypi.python.org/pypi/scspell3k): Spell checker for -source code written in Python. + source code written in Python. ```bash pip install scspell3k @@ -13,7 +13,7 @@ source code written in Python. ## How to use -Just run `scspell.sh ` +Just run `scspell.sh`. ```bash bash tools/spell-check/scspell.sh |