toolcontext: provide option `set-dummy-tool` used to fix the `toolname` and `version` services so they return respectively "DUMMY_TOOL" and "DUMMY_VERSION".

Useful for testing.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
template: add `Template::addn` service

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
toolcontext: add `bash_completion` generation option for nit tools.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
lib/standard: assert "/home/../".simplify_path == "/"

Fixes #614

Signed-off-by: Jean Privat <jean@pryen.org>
tests: add `test_toolcontext`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Merge: Tired of having to remember all the Nit options? Try bash_completion!

This PR enables the option --gen-bash-completion that allow user to generate a bash completion file.

Exemple with `nitdoc`:

    $ nitdoc --gen-bash-completion
    $ sudo ln -s <nitdir>/bin/nitdoc.bash /etc/bash_completion.d/nitdoc
    $ . /etc/bash_completion.d/nitdoc

Then:

    $ nitdoc [TAB][TAB]
    $ file1.nit    file2.nit    file3.nit

    $ nitdoc --[TAB][TAB]
    --bash-toolname         --github-base-sha1      --no-dot                --sharedir
    --custom-brand          --github-gitdir         --only-metamodel        --shareurl
    --custom-footer-text    --github-upstream       --only-parse            --source
    --custom-overview-text  --help                  --path                  --stop-on-first-error
    --custom-title          --ignore-visibility     --piwik-site-id         --verbose
    --dir                   --log                   --piwik-tracker         --version
    --disable-phase         --log-dir               --private               --warn
    --gen-bash-completion   --no-color              --quiet

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #575
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Merge: lib/standard: assert "/home/../".simplify_path == "/"

Fixes #614

Pull-Request: #615
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
gitignore: some update

Signed-off-by: Jean Privat <jean@pryen.org>
lib/bufferized_ropes: Added module bufferized_ropes to lib.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/standard/ropes: Added BufferLeaf to constructors.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/bufferized_ropes: Added lazy operations for substring and to_s on FlatBuffer.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/bufferized_ropes: Added methods to handle creation of a new node in a Rope.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/bufferized_ropes: Adapted substring and insert_at for bufferized ropes.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/bufferized_ropes: Added tests for bufferized ropes.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/bufferized_ropes: Added default size of a buffer for rope leaves.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/bufferized_ropes: Redef to_leaf in concat to work with BufferLeaf

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/standard/ropes: Adapted substring iterators to new API.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib: intro `FStream::fd`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/opts: cleaner init

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
tool_context: bashcompletion use the basename of sys.program_name

as program_name can be a complex path.

Signed-off-by: Jean Privat <jean@pryen.org>