WP-CLI support not aliasing correctly

I’m looking at wp-cli support via v-add-user-wp-cli jsmith

But it looks like the line in the v-add-user-wp-cli:

user_exec echo -e "#add wp-cli alias for user\nalias wp='php $WPCLI_BIN'" >> ~/.bashrc

Isn’t executing. I don’t see wp-cli being added to the user’s .bashrc file and the wp command isn’t working. Aliasing via

echo "alias wp=/home/"$user"/.wp-cli/wp" >> /home/$user/.bash_aliases

DOES work. This is more inline with the way the v-add-user-composer support is implemented in Hestia; using alias and appending to the protected .bash_aliases file.

Further, it looks like the current .bashrc addition is redundant as php $WPCLI_BIN is adding the php interpreter to the binary, which is already marked for execution and doesn’t need the php prefix.

Anyone else seeing this? You can remove wp-cli via rm -rf ~/.wp-cli to re-add via v-add-user-wp-cli <username> to check. Please confirm and I can add an issue and associated GitHub PR.

Regards,
Steve

Hello @Steveorevo,

Because it is being added to .bashrc file to the user who is executing the command v-add-user-wp-cli, check your /root/.bashrc

I confirm the issue, you could add a PR to fix it :wink:

Cheers,
sahsanu

1 Like

Pull request 4002 submitted.

2 Likes

Merged …

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.