package Cpanel::Easy::Apache::UI::CLI::Help;

# cpanel - Cpanel/Easy/Apache/UI/CLI/Help.pm        Copyright(c) 2014 cPanel, Inc.
#                                                             All rights Reserved.
# copyright@cpanel.net                                           http://cpanel.net
# This code is subject to the cpanel  license. Unauthorized  copying is prohibited

use strict;
use warnings;

sub do_help_and_exit {
    my ($easy) = @_;

    print <<'END_PUBLIC';
Easy::Apache CLI Switches

Note: Unless otherwise noted these are boolean options.
  IE:
    --flag=0 is the same as not specifying it
    --flag=1 is the same as specifying it

  --help 
    this screen

  --help=hooks
    hook script support information

  --version
    Report version info of ea3, cpanel, and apache   

  --latest-versions
    List latest version of Apache, PHP, etc that this installs

  --show-apache-defaults 
    Show default apache module information

  --profile=profile_name 
    'profile_name' is one of:
      a) absolute path to yaml file to use as profile
      b) name relative to /var/cpanel/easy/apache/profile/custom/ without the .yaml extension
    These would all be the same profile:
      --profile=cpanel_no_php 
      --profile=cpanel_no_php.yaml
      --profile=/var/cpanel/easy/apache/profile/custom/cpanel_no_php.yaml

  --build 
    Skip configuration and go straight to the build. 
    It builds the 'last saved' profile if no profile is specified with --profile. 
    If there is no 'last saved' profile it will use 'cpanel_default'

  --skip-cpanel-version-check
    Do not check to see that the server's cPanel is the latest available

  --restore-archive
    Bring up UI to choose available archives and restore them if desired

  --restore-archive=listonly
    List available archives only      
   
  --restore-archive=/path/to/easyapache/archive
    Attempt to restore this build archive
    !! only use if you are 100% sure the path is an easyapache build archive !!

[ prefs ]
  --notify_cpanel
  --do_not_revert_on_conf_failure
  --do_not_revert_on_test_failure
  --archive_backup
  --reset_httpd_config_to_default
  --always_do_the_latest_phps (takes precedence over --always_do_the_oldest_phps) 
  --always_do_the_oldest_phps 
  --prefer_profile_php_over_always_do_the_latest_phps
  --prefer_profile_php_over_always_do_the_oldest_phps
  --check_httpd_after_each_test

[ development and testing ]
  --debug
    Include detailed debug data in output

  --skip-rawopts
    Do not use raw opts support

  --skip-rawenv
    Do not use raw env support

  --skip-hooks
    Do not execute any hook scripts

  --skip-custom-optmods
    Do not build any opt mods that are not included in ea3 core
    (Note: these will still show in the UI for convienience)
  
  --stack
    Turn on stack trace in cplog messages

  --perl-devel-profiler 
    Include process profile data in output

  --perl-devel-profiler=fprof
    Run under Devel::FastProf in addition to normal --perl-devel-profiler behavior
    This may not work on all systems

  --debug-profile-revision
    Output debug information about calculating the profile _meta->revision key

  --output-syspkg-details
    Output details about Cpanel::SysPkgs calls
    
  --only-tarballs-and-pkgs
    Run only the tarball and system package check with verbose information

END_PUBLIC
    my $type = $easy->get_param('help');
    if ( $type eq 'tech' || $type eq 'qa' || $type eq 'dev' ) {
        print <<'END_INTERNAL';
  --perldoc
    Show POD for Cpanel::Easy framework

  --skip-bg 
    Do not run build in background

  --skip-cpanelsync 
    Do not do initial cpanelsync (IE to not overwrite changes for testing)

  --skip-memtest
    Do not do the cPanel::MemTest pre allocation memory test

  --memtest-mb
    Number of MB between 1 and 1024 to use in the cPanel::MemTest pre allocation memory test

  --skip-disktest
    Do not check the amount of free disk space in the build filesystem

  --disktest-mb
    Minimum amount of free disk space to require between 1 and 4096 MB

  --no-targz-yaml
    Do not fetch latest targz.yaml meta data file

  --skip-create-state
    Do not regenerate state even if it needs it

  --force-create-state
    Regenerates state if it needs it or not (overrides --skip-create-state)

  --only=NS  
    Only run this name space ( Cpanel::Easy:: can be left off ) [multiples ok]

  --skip=NS 
    Skip this name space ( Cpanel::Easy:: can be left off ) [multiples ok]
    Note:if --skip and --only are specified, skip is ignored and only --only is used
 
  --simulate-failed-syspkgs
    Simulates failed Cpanel::SysPkgs

  --simulate-failed-build
    Simulates a failed build (right before any actual opt mods are run)

  --simulate-failed-confgen
    Simulates failed httpd.conf generation after a successful build

  --simulate-failed-memtest
    Simulates failed cPanel::MemTest pre allocation memory test

  --simulate-failed-test-soft
    Simulates a non-fatal post apache restart test failing

  --simulate-failed-test-hard
    Simulates a fatal post apache restart test failing

  --simulate-optlib-targz-check-loop
    Simulates a cycle of not being able to bring optlib tarball and .pm into sync
  
  --makecpphp (/usr/local/cpanel/scripts/easyapache --only=PHP5 --build --makecpphp --profile=/usr/local/cpanel/scripts/makecpphp.profile.yaml)

  --tier=<tier>
    Allows you to specify an alternate path to find EasyApache, outside of the
    traditional 'easy' directory.  The tier is in the following formats:

     o easy-X.Y.Z
     o easy-project-X.Y.Z

    'X', 'Y', and 'Z' are integers
    'project' can only contain letters and numbers

END_INTERNAL
    }

    exit;
}

1;
