Will pamac-cli support `-y` option

Pamac is an understandable tool compared with pacman or yay.

But the default behavior of pamac install is N, not Y, and if you want a yes without confirm you need a so-long option --no-confirm.

So will pamac support a short option, such as -y not only --no-confirm. Anyway, -y is a common option for other package managers , such as zypper, yum, dnf or apt.

I suppose this could be implemented in the pamac binary ─ I’m not a developer, but I’ll invite the @Manjaro-Team to come and take a look at this thread ─ but you could create an alias as a wrapper that does exactly that, if you wish.

Add the following to your ~/.bashrc if you use bash as your interactive shell, or to your ~/.zshrc if you use zsh as your interactive shell… :arrow_down:

alias pamaciy="pamac install --no-confirm"

You can then use the command pamaciy instead of pamac install, and it won’t ask you for confirmation.

Or you can build a function to check if -y is included, add the --no-confirm option if it is, or not if it’s not, and pass it on.

BUT I think the --no-confirm is better, because it forces you to think about what you’re actually doing.

3 Likes

I only know how to do that for bash ─ I don’t use zsh ─ but that would then be something like… :arrow_down:

pamac ()
{
  case $1 in
     "install" | "reinstall" | "remove" )
         if [ "$2" == "-y" ]
         then 
             action="$1 --no-confirm"
             shift 2
         fi
         ;;
  esac
  /usr/bin/pamac "${action}" "$@"
  [[ "${action}" ]] && unset action
}
export pamac

Disclaimer: I’ve just written that, ad hoc, so I haven’t tested it. But I think it should work. :crossed_fingers:

@douglarek, if you do run bash and you want to make use of this function, add it to your ~/.bashrc and execute the command… :arrow_down:

source ~/.bashrc

… to have it immediately available in the running shell.

2 Likes

I also would have done it in bash, I use zsh but have never written a script for it.

:wink:

Shebangs are wonderful things!

We doesn’t need a shebang if we includes it in our ~/.bashrc, Preciousss. :crazy_face:

1 Like

I’ve debugged the function. It should be flawless now. Any volunteers for testing? :stuck_out_tongue: :face_with_hand_over_mouth:

1 Like

Happy you had something to keep you entertained. :stuck_out_tongue_winking_eye:

Well, that’s good. I guess. In my opinion, any and all code is flawless, until it’s not…still, well done then!

I’ll keep it handy for now, use it as I go along. But I wouldn’t hold my breath if I were you. I don’t like not knowing what my PC’s up to, so never ever use --no-confirm.

1 Like

2 Likes