tool_context: just print the bash_completion, let the caller do what it want
[nit.git] / src / toolcontext.nit
index 36ed661..6aeda8d 100644 (file)
@@ -255,8 +255,7 @@ class ToolContext
                end
 
                if opt_bash_completion.value then
-                       print bash_completion.write_to_string
-                       bash_completion.write_to_file("{sys.program_name}.bash")
+                       bash_completion.write_to(sys.stdout)
                        exit 0
                end
 
@@ -301,7 +300,7 @@ class ToolContext
                if opt_set_dummy_tool.value then
                        return "DUMMY_TOOL"
                end
-               return sys.program_name
+               return sys.program_name.basename("")
        end
 
        # The identified root directory of the Nit project
@@ -382,8 +381,7 @@ class BashCompletion
                        addn "          return 0"
                        addn "  fi"
                end
-               addn "  _filedir"
-               addn "\}"
-               addn "complete -F _{name} {name}"
+               addn "\} &&"
+               addn "complete -o default -F _{name} {name}"
        end
 end