【问题标题】:cakephp console without prompt (-f option?)没有提示的 cakephp 控制台(-f 选项?)
【发布时间】:2015-10-16 18:37:00
【问题描述】:

一些 CakeConsole 命令(如schema update)需要用户确认操作。 (Are you sure… 消息)

我想在Puppet下使用(自动安装)所以没有实际用户输入yes确认。

是否有任何选项可以强制控制台执行此操作?不问用户?

【问题讨论】:

    标签: cakephp cakephp-2.0 cake-console


    【解决方案1】:

    有一个选项

    --yes, -y 不提示确认。小心!

    -> app/Console/cake schema update --help
    
    Welcome to CakePHP v2.8.0-dev Console
    ---------------------------------------------------------------
    App : app
    Path: /var/www/someapp.dev/
    ---------------------------------------------------------------
    Usage:
    cake schema update [options]
    
    Options:
    
    --help, -h        Display this help.
    --verbose, -v     Enable verbose output.
    --quiet, -q       Enable quiet output.
    --plugin, -p      The plugin to use.
    --path            Path to read and write schema.php (default:
                      /var/www/someapp.dev/app/Config/Schema)
    --file            File name to read and write.
    --name            Classname to use. If its Plugin.class, both name and
                      plugin options will be set.
    --connection, -c  Set the db config to use. (default:
                      default)
    --dry             Perform a dry run on create and update commands.
                      Queries will be output instead of run.
    --snapshot, -s    Snapshot number to use/make.
    --force, -f       Force "generate" to create a new schema
    --yes, -y         Do not prompt for confirmation. Be careful!
    

    但是 yes 选项未添加 until 2.5 - 如果您使用的是 2.x 的早期版本,则需要升级才能使用此选项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-03
      • 1970-01-01
      • 2021-11-04
      • 1970-01-01
      • 1970-01-01
      • 2021-10-13
      • 1970-01-01
      相关资源
      最近更新 更多