Sha256: cf56bf2b1a36fd0d6d4c75b34c18c96fdcc4510f0f0e9c95a54dc8bf64720049
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
require 'sct/command_interface' require 'sct/command_option' module Sct class PhpCommand IS_PUBLIC_COMMAND = true SYNTAX = 'sct php' SUMMARY = 'Run php commands through SCT' EXAMPLE = 'sct php -r "echo \'Hello World!\';"' EXAMPLE_DESCRIPTION = 'sct php -r will execute a command directly through the php interpreter' DESCRIPTION = "sct will run php commands through the local docker installation" OPTIONS = [ CommandOption.new("-r", String, "Run php code directy through the interpreter"), CommandOption.new("-V", nil, "Get the current php version. Note that it's a capital V. The lowercase v will return the SCT tool version"), ] def execute(args, options) require "sct/docker/php" # Workaround for the version option being caught by the SCT tool itself args=ARGV[1..(ARGV.length+1)].map { |arg| arg == '-V' ? arg = '-v' : arg} # Another workaround for the -r option to add quotes around the value if args.include? '-r' codeIndex = args.index('-r') + 1 args[codeIndex] = "\"#{args[codeIndex]}\"" end Sct::Php.exec(args) end implements CommandInterface end end
Version data entries
15 entries across 15 versions & 1 rubygems