Git Product home page Git Product logo

Comments (5)

lox avatar lox commented on May 18, 2024

Yup, I've wanted to do this for a while. Unfortunately I'm a zsh user, but I think it can be done such that it's portable.

from aws-vault.

lox avatar lox commented on May 18, 2024

Apparently this is somewhat helped by the cli library we use: https://github.com/alecthomas/kingpin#bashzsh-shell-completion

from aws-vault.

jedi4ever avatar jedi4ever commented on May 18, 2024

@lox this build in completion will only help for the aws-vault options
afaik this will not pass commandcompletion to the execed command
for that the command offset is needed , but I guess it's a good start to hack on

from aws-vault.

jedi4ever avatar jedi4ever commented on May 18, 2024

I tried the build in eval "$(aws-vault --completion-script-bash)"
but it says --completion-script-bash option is not found.

I've made some progress on the completion of the exec command.

aws-vault exec profile1 -- make <TAB> now expands correctly the make tasks

I'll continue to enhance it with the aws-vault options.

# bash completion for aws-vault                             -*- shell-script -*-

_aws_vault()
{
    local cur prev words cword

    local i

    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    for (( i=1; i <= COMP_CWORD; i++ )); do
        if [[ ${COMP_WORDS[i]} == -- ]]; then
            local root_command=${COMP_WORDS[i]}
            _command_offset $i+1
            return
        fi
    done

} && complete -F _aws_vault aws-vault

from aws-vault.

lox avatar lox commented on May 18, 2024

Nice! I've been working on getting the latest cli stuff into aws-vault so that we can at least use kingpin to output the above script when --completion-script-bash is passed.

from aws-vault.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.