Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tphp command #233

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft

Add tphp command #233

wants to merge 1 commit into from

Conversation

scq
Copy link
Member

@scq scq commented Dec 21, 2022

This PR adds a tphp command for executing commands inside the php container.

Example:

sc ~/c/t/learn> tdb drop
Successfully dropped pgsql14 database learn_17
sc ~/c/t/learn> tdb create
Successfully created pgsql14 database learn_17
sc ~/c/t/learn> tphp install
Using PHP Container: php-8.1
Running Command: php server/admin/cli/install_database.php --adminpass=admin --adminemail=admin@example.com --agree-license --shortname=Totara 17 development site --fullname=Totara 17 development site
Totara 17.0+ (Build: 20221108.00) command line installation program
-------------------------------------------------------------------------------
== Setting up database ==
-->System
++ Success ++
-->totara_core
++ Success ++

This makes it a bit more convenient to use the install/cron/purge/etc aliases without needing to tbash in to the container.

@scq scq changed the base branch from master to develop December 21, 2022 22:44
bin/tphp Outdated
script_path="$( cd "$(dirname "$0")" ; pwd -P )"

if [[ -z "$1" ]]; then
$script_path/tbash php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of people are using tzsh instead of tbash. Can you think of a way to make this configurable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point! How about a variable in .env?

I've called it INTERACTIVE_SHELL since SHELL is an existing standard environment variable (and we only use the variable where we want an interactive shell, otherwise we use bash), but open to better naming suggestions. It defaults to bash.

We could potentially also add a tshell command that runs either bash or zsh depending on your configuration, but I haven't done it here. Might be useful to use in the docs.

bin/tbash Show resolved Hide resolved
Copy link
Member

@derschatta derschatta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good :)

@scq
Copy link
Member Author

scq commented Aug 29, 2023

I've been using it locally for a while and discovered some issues with handling of args recently, will just convert it to a draft until I fix those

@scq scq marked this pull request as draft August 29, 2023 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PHP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants