laravel / envoy

Elegant SSH tasks for PHP.
https://laravel.com/docs/envoy
MIT License
1.57k stars 178 forks source link

Can't get value of snake case variables #231

Closed ybert closed 3 years ago

ybert commented 3 years ago

Description:

It seems that it is not possible to set snake case variables for envoy run deploy

Steps To Reproduce:

Envoy.blade.php :

@servers(['deployment' => '127.0.0.1'])

@setup
    if (empty($user)) {
        exit('ERROR: $user var empty or not defined');
    }
    if (empty($host)) {
        exit('ERROR: $host var empty or not defined');
    }
    if (empty($app_dir)) {
        exit('ERROR: $app_dir var empty or not defined');
    }
    if (empty($release_path)) {
        exit('ERROR: $release_path var empty or not defined');
    }
@endsetup

@task('deploy', ['on' => 'deployment'])
    exit ("deploy");
@endtask

When I run vendor/bin/envoy run deploy --user=www --host=staging.company.com --app_dir=/home/www/public I get ERROR: $app_dir var empty or not defined

So it seems that it works perfectly with non snake case variables like --user or --host but not with --app_dir

driesvints commented 3 years ago

This is indeed not supported.

ybert commented 3 years ago

@driesvints It was supported in previous version of Envoy (1.*) It seems Hyphen case is not supported. So we have to name our variables like --appdir or --releasepath Its not very readable.

driesvints commented 3 years ago

If you can come up with a PR that implements this in a clean way we may consider it.

finagin commented 3 years ago

@ybert, use --app-dir to call in code $app_dir or $appDir