[Bash-completion-devel] [bash-completion-Bugs][314417] completion for cc and c++ does not work

Igor Murzov e-mail at date.by
Sun Sep 8 21:19:53 UTC 2013


> complete -F _gcc gcc g++ g77 gcj gpc &&{
>     cc  --version 2>/dev/null | grep -q GCC && complete -F _gcc cc  || :
>     c++ --version 2>/dev/null | grep -q GCC && complete -F _gcc c++ || :
> }

Looking in this code, i wonder why there is no such lines for gfortran?
Is there some issues with it?

I wrote a quick patch for gfortran. Is it ok to push?
-------------------------------------------------------------
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 69f0e2c..90ffd9e 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -430,13 +430,17 @@ CLEANFILES = \
 	dpkg-reconfigure \
 	dropdb \
 	edquota \
+	f77 \
+	f95 \
 	filebucket \
 	freeciv-sdl \
 	freeciv-xaw \
 	g++ \
 	g4 \
 	g77 \
+	g95 \
 	gcj \
+	gfortran \
 	gkrellm2 \
 	gmake \
 	gmplayer \
@@ -662,7 +666,7 @@ symlinks: $(targetdir) $(DATA)
 		rm -f $(targetdir)/$$file && \
 			$(LN_S) function $(targetdir)/$$file ; \
 	done
-	for file in g++ c++ g77 gcj gpc cc ; do \
+	for file in cc c++ g++ gfortran f77 g77 f95 g95 gcj gpc ; do \
 		rm -f $(targetdir)/$$file && \
 			$(LN_S) gcc $(targetdir)/$$file ; \
 	done
diff --git a/completions/gcc b/completions/gcc
index 578f800..481d9cf 100644
--- a/completions/gcc
+++ b/completions/gcc
@@ -27,6 +27,9 @@ _gcc()
         *77)
             backend=f771
             ;;
+        *95)
+            backend=f951
+            ;;
         *)
             backend=cc1 # (near-)universal backend
             ;;
@@ -45,7 +48,7 @@ _gcc()
         _filedir
     fi
 } &&
-complete -F _gcc gcc g++ g77 gcj gpc &&
+complete -F _gcc gcc g++ gfortran g77 g95 gcj gpc &&
 {
     cc  --version 2>/dev/null | grep -q GCC || \
         [[ $( _realcommand cc ) == *gcc* ]] && \
@@ -53,6 +56,12 @@ complete -F _gcc gcc g++ g77 gcj gpc &&
     c++ --version 2>/dev/null | grep -q GCC || \
         [[ $( _realcommand c++ ) == *g++* ]] && \
         complete -F _gcc c++ || complete -F _minimal c++
+    f77 --version 2>/dev/null | grep -q GCC || \
+        [[ $( _realcommand f77 ) == *gfortran* ]] && \
+        complete -F _gcc f77 || complete -F _minimal f77
+    f95 --version 2>/dev/null | grep -q GCC || \
+        [[ $( _realcommand f95 ) == *gfortran* ]] && \
+        complete -F _gcc f95 || complete -F _minimal f95
 }
 
 # ex: ts=4 sw=4 et filetype=sh
-------------------------------------------------------------


-- Igor



More information about the Bash-completion-devel mailing list