$ ipfs version --all
go-ipfs version: 0.4.13-
Repo version: 6
System version: amd64/linux
Golang version: go1.9.2
Enhancement
N/A
Currently, ipfs provides bash completion through: https://github.com/ipfs/go-ipfs/blob/master/docs/command-completion.md
IMHO, it is much easier if you could just generate the bash completion script with, say: ipfs completion bash > /etc/bash_completion.d/ipfs. This feature is implemented by k8s, for example:
$ kubectl completion bash
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# bash completion for kubectl -*- shell-script -*-
__debug()
{
if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
fi
}
# Homebrew on Macs have version 1.3 of bash-completion which doesn't include
# _init_completion. This is a very minimal version of that function.
__my_init_completion()
{
COMPREPLY=()
_get_comp_words_by_ref "$@" cur prev words cword
}
__index_of_word()
{
local w word=$1
shift
index=0
for w in "$@"; do
[[ $w = "$word" ]] && return
index=$((index+1))
done
index=-1
}
...
Which means that this is generated programmatically and, probably, using introspection. In any case, this would be easier to maintain, IMHO.
Not clear enough (up there, you have Feature as an option). Sorry if I made a feature request where it wasn't allowed.
The trickiest part will be completing paths. It would be awesome if we could do that reliably but that will take some modifications to the cmds library.
However, simply completing commands and flags is totally doable.
Most helpful comment
The trickiest part will be completing paths. It would be awesome if we could do that reliably but that will take some modifications to the cmds library.
However, simply completing commands and flags is totally doable.