diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/ninja_syntax.py | 5 | ||||
-rwxr-xr-x | misc/ninja_syntax_test.py | 6 | ||||
-rw-r--r-- | misc/zsh-completion | 5 |
3 files changed, 11 insertions, 5 deletions
diff --git a/misc/ninja_syntax.py b/misc/ninja_syntax.py index 8673518..73d2209 100644 --- a/misc/ninja_syntax.py +++ b/misc/ninja_syntax.py @@ -21,8 +21,9 @@ class Writer(object): def newline(self): self.output.write('\n') - def comment(self, text): - for line in textwrap.wrap(text, self.width - 2): + def comment(self, text, has_path=False): + for line in textwrap.wrap(text, self.width - 2, break_long_words=False, + break_on_hyphens=False): self.output.write('# ' + line + '\n') def variable(self, key, value, indent=0): diff --git a/misc/ninja_syntax_test.py b/misc/ninja_syntax_test.py index 36b2e7b..c9755b8 100755 --- a/misc/ninja_syntax_test.py +++ b/misc/ninja_syntax_test.py @@ -45,6 +45,12 @@ class TestLineWordWrap(unittest.TestCase): INDENT + 'y']) + '\n', self.out.getvalue()) + def test_comment_wrap(self): + # Filenames shoud not be wrapped + self.n.comment('Hello /usr/local/build-tools/bin') + self.assertEqual('# Hello\n# /usr/local/build-tools/bin\n', + self.out.getvalue()) + def test_short_words_indented(self): # Test that indent is taking into acount when breaking subsequent lines. # The second line should not be ' to tree', as that's longer than the diff --git a/misc/zsh-completion b/misc/zsh-completion index ad7b87f..446e269 100644 --- a/misc/zsh-completion +++ b/misc/zsh-completion @@ -22,8 +22,8 @@ __get_targets() { then eval dir="${opt_args[-C]}" fi - targets_command="ninja -C \"${dir}\" -t targets" - eval ${targets_command} 2>/dev/null | sed "s/^\(.*\): .*$/\1/" + targets_command="ninja -C \"${dir}\" -t targets all" + eval ${targets_command} 2>/dev/null | cut -d: -f1 } __get_tools() { @@ -65,4 +65,3 @@ _arguments \ '-d+[Enable debugging (use -d list to list modes)]:modes:__modes' \ '-t+[Run a subtool (use -t list to list subtools)]:tools:__tools' \ '*::targets:__targets' - |