Skip to content

Commit 39a2388

Browse files
authored
Use advanced Bash in entrypoint
1 parent f77d252 commit 39a2388

File tree

1 file changed

+25
-54
lines changed

1 file changed

+25
-54
lines changed

entrypoint

Lines changed: 25 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,28 @@
11
#!/bin/bash
2-
set -e
3-
4-
command_string="phpstan --no-interaction --no-progress"
5-
6-
if [ -n "$action_command" ]
7-
then
8-
command_string="$command_string $action_command"
9-
fi
10-
11-
if [ -n "$action_configuration" ]
12-
then
13-
command_string="$command_string --configuration='$action_configuration'"
14-
fi
15-
16-
if [ -n "$action_level" ]
17-
then
18-
command_string="$command_string --level=$action_level"
19-
fi
20-
21-
if [ -n "$action_paths_file" ]
22-
then
23-
command_string="$command_string --paths-file='$action_paths_file'"
24-
fi
2+
#
3+
# Entrypoint for php-actions/phpstan
4+
#
255

26-
if [ -n "$action_autoload_file" ]
27-
then
28-
command_string="$command_string --autoload-file='$action_autoload_file'"
29-
fi
30-
31-
if [ -n "$action_error_format" ]
32-
then
33-
command_string="$command_string --error-format=$action_error_format"
34-
fi
35-
36-
if [ -n "$action_generate_baseline" ]
37-
then
38-
command_string="$command_string --generate-baseline=$action_generate_baseline"
39-
fi
40-
41-
if [ -n "$action_memory_limit" ]
42-
then
43-
command_string="$command_string --memory-limit=$action_memory_limit"
44-
fi
45-
46-
if [ -n "$action_args" ]
47-
then
48-
command_string="$command_string $action_args"
49-
fi
50-
51-
if [ -n "$action_path" ]
52-
then
53-
command_string="$command_string $action_path"
54-
fi
6+
set -e
557

56-
echo "Command: $command_string"
57-
eval "$command_string"
8+
Get_command()
9+
{
10+
echo -n "phpstan --no-interaction --no-progress ${action_command}"
11+
for env in action_configuration action_level \
12+
action_paths_file action_autoload_file action_error_format \
13+
action_generate_baseline action_memory_limit
14+
do
15+
option="${!env}"
16+
option_name="${env#action_}"
17+
if [ -z "${option}" ]; then
18+
continue
19+
fi
20+
echo -n " --${option_name//_/-}='${option}'"
21+
done
22+
echo -n " ${action_args} ${action_path}"
23+
}
24+
25+
command_string="$(Get_command)"
26+
27+
echo "Command: ${command_string}"
28+
eval "${command_string}"

0 commit comments

Comments
 (0)