Add completions for ninja build system #3415

Merged
merged 1 commit into from Oct 4, 2016

Projects

None yet

2 participants

@bsott
Contributor
bsott commented Sep 27, 2016

Description

https://ninja-build.org/

Tested on ubuntu 16.{04,10} & OS X 10.11

@@ -0,0 +1,5 @@
+function __fish_print_ninja_targets
+ if [ -f build.ninja ]
+ ninja -t targets | sed 's/:.*//'
@faho
faho Sep 28, 2016 Member

What happens here when you call ninja without that file?

If it's just some error message, it's probably easier to suppress it so this can be used even if there's some other filename that ninja can use (now or in the future).

@faho
faho Sep 28, 2016 Member

Also, we try to use our string tool in our completions - string replace -r ':.*' ''.

@bsott
bsott Sep 28, 2016 Contributor

You mean something like

...
ninja -t targets | string replace -r ':.*' '' 2> /dev/null

?

@faho
faho Sep 28, 2016 Member

With the redirection after the ninja, not the string call. Otherwise yes.

@@ -0,0 +1,4 @@
+function __fish_print_ninja_tools
+ echo list
+ ninja -t list | grep -v ':' | sed -Ee 's/[[:space:]]+([^[:space:]]+).*/\1/'
@faho
faho Sep 28, 2016 Member

As above, string is your friend here - string match -v ':' | string replace -r '\s+(\S+).*' '$1' (untested).

The "-E" option to sed is problematic as it's completely undocumented for GNU sed (though it appears to work).

@bsott
bsott Sep 28, 2016 Contributor

fixed, I've squashed it back to 1 commit

@faho faho added this to the fish 2.4.0 milestone Sep 28, 2016
@faho
faho approved these changes Oct 4, 2016 View changes
@faho faho merged commit 61388cf into fish-shell:master Oct 4, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@faho
Member
faho commented Oct 4, 2016

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment