Skip to content

Commit

Permalink
[TASK] Added help texts to most commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuench committed Oct 16, 2013
1 parent dde63e3 commit 2805f04
Show file tree
Hide file tree
Showing 40 changed files with 420 additions and 21 deletions.
5 changes: 5 additions & 0 deletions changes.txt
Expand Up @@ -9,6 +9,11 @@ RECENT CHANGES
* Support for modules inside the vendor folder if app is not in phar mode
* db:dump - Added two new table group for strip option (idx, ee_changelog)
* Fixed problem with installer and target path "."
* Added twig debug extension
* dev:module:create command -> Replaced hard coded year with a dynamic version.
* Added cast_to_array twig filter
* Added help texts for most commands
* #228 - Command "config:delete" does not support wildcard *

======
1.79.0
Expand Down
Binary file modified n98-magerun.phar
Binary file not shown.
2 changes: 1 addition & 1 deletion res/twig/dev/module/create/app/etc/modules/readme.twig
Expand Up @@ -58,4 +58,4 @@ Licence

Copyright
---------
(c) 2012 {{ vendorNamespace }}
(c) {{ "now"|date("Y") }} {{ vendorNamespace }}
10 changes: 10 additions & 0 deletions src/N98/Magento/Command/Cache/CleanCommand.php
Expand Up @@ -17,6 +17,16 @@ protected function configure()
->addArgument('type', InputArgument::OPTIONAL, 'Cache type code like "config"')
->setDescription('Clean magento cache')
;

$help = <<<HELP
Cleans expired cache entries.
If you like to remove all entries use `cache:flush`
Or only one cache type like i.e. full_page cache:
$ n98-magerun.phar cache:clean full_page
HELP;
$this->setHelp($help);
}

public function isEnabled()
Expand Down
8 changes: 8 additions & 0 deletions src/N98/Magento/Command/Config/AbstractConfigCommand.php
Expand Up @@ -15,6 +15,14 @@ protected function getEncryptionModel()
->setHelper($this->getCoreHelper());
}

/**
* @return \Mage_Core_Model_Abstract
*/
protected function _getConfigDataModel()
{
return $this->_getModel('core/config_data', 'Mage_Core_Model_Config_Data');
}

/**
* @param string $value
* @param boolean $decryptionRequired
Expand Down
22 changes: 22 additions & 0 deletions src/N98/Magento/Command/Config/DumpCommand.php
Expand Up @@ -16,6 +16,28 @@ protected function configure()
->addArgument('xpath', InputArgument::OPTIONAL, 'XPath to filter XML output', null)
->setDescription('Dump merged xml config')
;

$help = <<<HELP
Dumps merged XML configuration to stdout. Useful to see all the XML.
You can filter the XML with first argument.
Examples:
Config of catalog module
$ n98-magerun.phar config:dump global/catalog
See module order in XML
$ n98-magerun.phar config:dump modules
Write output to file
$ n98-magerun.phar config:dump > extern_file.xml
HELP;
$this->setHelp($help);

}

/**
Expand Down
13 changes: 5 additions & 8 deletions src/N98/Magento/Command/Config/GetCommand.php
Expand Up @@ -31,14 +31,11 @@ protected function configure()
->addOption('update-script', null, InputOption::VALUE_NONE, 'Output as update script lines')
->addOption('magerun-script', null, InputOption::VALUE_NONE, 'Output for usage with config:set')
;
}

/**
* @return \Mage_Core_Model_Abstract
*/
protected function _getConfigDataModel()
{
return $this->_getModel('core/config_data', 'Mage_Core_Model_Config_Data');
$help = <<<HELP
If path is not set, all available config items will be listed. path may contain wildcards (*)
HELP;
$this->setHelp($help);
}

/**
Expand All @@ -54,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$collection = $this->_getConfigDataModel()->getCollection();
$searchPath = $input->getArgument('path');

if(substr($input->getArgument('path'), -1, 1) === '/') {
if (substr($input->getArgument('path'), -1, 1) === '/') {
$searchPath .= '*';
}

Expand Down
7 changes: 7 additions & 0 deletions src/N98/Magento/Command/Config/SetCommand.php
Expand Up @@ -29,6 +29,13 @@ protected function configure()
->addOption('scope-id', null, InputOption::VALUE_OPTIONAL, 'The config value\'s scope ID', '0')
->addOption('encrypt', null, InputOption::VALUE_NONE, 'The config value should be encrypted using local.xml\'s crypt key')
;

$help = <<<HELP
Set a store config value by path.
To set a value of a specify store view you must set the "scope" and "scope-id" option.
HELP;
$this->setHelp($help);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/N98/Magento/Command/Customer/ChangePasswordCommand.php
Expand Up @@ -18,6 +18,12 @@ protected function configure()
->addArgument('website', InputArgument::OPTIONAL, 'Website of the customer')
->setDescription('Changes the password of a customer.')
;

$help = <<<HELP
- Website parameter must only be given if more than one websites are available.
HELP;
$this->setHelp($help);

}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/N98/Magento/Command/Customer/CreateCommand.php
Expand Up @@ -18,7 +18,7 @@ protected function configure()
->addArgument('firstname', InputArgument::OPTIONAL, 'Firstname')
->addArgument('lastname', InputArgument::OPTIONAL, 'Lastname')
->addArgument('website', InputArgument::OPTIONAL, 'Website')
->setDescription('Creates a customer.')
->setDescription('Creates a new customer/user for shop frontend.')
;
}

Expand Down
2 changes: 1 addition & 1 deletion src/N98/Magento/Command/Customer/CreateDummyCommand.php
Expand Up @@ -36,7 +36,7 @@ protected function configure()
->addArgument('count', InputArgument::REQUIRED, 'Count')
->addArgument('locale', InputArgument::REQUIRED, 'Locale')
->addArgument('website', InputArgument::OPTIONAL, 'Website')
->setDescription('Creates a dummy customers.')
->setDescription('Generate dummy customers. You can specify a count and a locale.')
->setHelp($help)
;
}
Expand Down
2 changes: 1 addition & 1 deletion src/N98/Magento/Command/Customer/InfoCommand.php
Expand Up @@ -22,7 +22,7 @@ protected function configure()
->setName('customer:info')
->addArgument('email', InputArgument::OPTIONAL, 'Email')
->addArgument('website', InputArgument::OPTIONAL, 'Website of the customer')
->setDescription('Show infos about a customer');
->setDescription('Loads basic customer info by email address.');
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/N98/Magento/Command/Customer/ListCommand.php
Expand Up @@ -16,6 +16,13 @@ protected function configure()
->addArgument('search', InputArgument::OPTIONAL, 'Search query')
->setDescription('Lists customers')
;

$help = <<<HELP
List customers. The output is limited to 1000 (can be changed by overriding config).
If search parameter is given the customers are filtered (searchs in firstname, lastname and email).
HELP;
$this->setHelp($help);

}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/N98/Magento/Command/Database/CreateCommand.php
Expand Up @@ -15,6 +15,13 @@ protected function configure()
->setName('db:create')
->setDescription('Create currently configured database')
;

$help = <<<HELP
The command tries to create the configured database according to your
settings in app/etc/local.xml.
The configured user must have "CREATE DATABASE" privileges on MySQL Server.
HELP;
$this->setHelp($help);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/N98/Magento/Command/Database/DropCommand.php
Expand Up @@ -16,6 +16,13 @@ protected function configure()
->addOption('force', 'f', InputOption::VALUE_NONE, 'Force')
->setDescription('Drop current database')
;

$help = <<<HELP
The command prompts before dropping the database. If --force option is specified it
directly drops the database.
The configured user in app/etc/local.xml must have "DROP" privileges.
HELP;
$this->setHelp($help);
}

/**
Expand Down
43 changes: 43 additions & 0 deletions src/N98/Magento/Command/Database/DumpCommand.php
Expand Up @@ -36,6 +36,49 @@ protected function configure()
->addOption('strip', 's', InputOption::VALUE_OPTIONAL, 'Tables to strip (dump only structure of those tables)')
->addOption('force', 'f', InputOption::VALUE_NONE, 'Do not prompt if all options are defined')
->setDescription('Dumps database with mysqldump cli client according to informations from local.xml');

$help = <<<HELP
Dumps configured magento database with `mysqldump`.
You must have installed the MySQL client tools.
On debian systems run `apt-get install mysql-client` to do that.
The command reads app/etc/local.xml to find the correct settings.
If you like to skip data of some tables you can use the --strip option.
The strip option creates only the structure of the defined tables and
forces `mysqldump` to skip the data.
Dumps your database and excludes some tables. This is useful i.e. for development.
Separate each table to strip by a space.
You can use wildcards like * and ? in the table names to strip multiple tables.
In addition you can specify pre-defined table groups, that start with an @
Example: "dataflow_batch_export unimportant_module_* @log
$ n98-magerun.phar db:dump --strip="@stripped"
Available Table Groups:
* @log Log tables
* @dataflowtemp Temporary tables of the dataflow import/export tool
* @stripped Standard definition for a stripped dump (logs and dataflow)
* @sales Sales data (orders, invoices, creditmemos etc)
* @customers Customer data
* @trade Current trade data (customers and orders). You usally do not want those in developer systems.
* @development Removes logs and trade data so developers do not have to work with real customer data
Extended: https://github.com/netz98/n98-magerun/wiki/Stripped-Database-Dumps
See it in action: http://youtu.be/ttjZHY6vThs
- If you like to prepend a timestamp to the dump name the --add-time option can be used.
- The command comes with a compression function. Add i.e. `--compress=gz` to dump directly in
gzip compressed file.
HELP;
$this->setHelp($help);

}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/N98/Magento/Command/Database/ImportCommand.php
Expand Up @@ -18,6 +18,13 @@ protected function configure()
->addOption('only-command', null, InputOption::VALUE_NONE, 'Print only mysql command. Do not execute')
->addOption('only-if-empty', null, InputOption::VALUE_NONE, 'Imports only if database is empty')
->setDescription('Imports database with mysql cli client according to database defined in local.xml');

$help = <<<HELP
Imports an SQL file with mysql cli client into current configured database.
You need to have MySQL client tools installed on your system.
HELP;

}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/N98/Magento/Command/Database/InfoCommand.php
Expand Up @@ -16,6 +16,13 @@ protected function configure()
->addDeprecatedAlias('database:info', 'Please use db:info')
->setDescription('Dumps database informations')
;

$help = <<<HELP
This command is useful to print all informations about the current configured database in app/etc/local.xml.
It can print connection string for JDBC, PDO connections.
HELP;
$this->setHelp($help);

}

/**
Expand Down
12 changes: 12 additions & 0 deletions src/N98/Magento/Command/Database/QueryCommand.php
Expand Up @@ -17,6 +17,18 @@ protected function configure()
->addOption('only-command', null, InputOption::VALUE_NONE, 'Print only mysql command. Do not execute')
->setDescription('Executes an SQL query on the database defined in local.xml')
;

$help = <<<HELP
Executes an SQL query on the current configured database. Wrap your SQL in
single or double quotes.
If your query produces a result (e.g. a SELECT statement), the output of the
mysql cli tool will be returned.
* Requires MySQL CLI tools installed on your system.
HELP;
$this->setHelp($help);
}

/**
Expand Down
Expand Up @@ -18,6 +18,14 @@ protected function configure()
->addOption('log-junit', null, InputOption::VALUE_REQUIRED, 'Log conflicts in JUnit XML format to defined file.')
->setDescription('Lists all magento rewrite conflicts')
;

$help = <<<HELP
Lists all duplicated rewrites and tells you which class is loaded by Magento.
The command checks class inheritance in order of your module dependencies.
* If a filename with `--log-junit` option is set the tool generates an XML file and no output to *stdout*.
HELP;
$this->setHelp($help);
}

/**
Expand Down
Expand Up @@ -24,8 +24,13 @@ protected function configure()
'base/default'
)
->addOption('log-junit', null, InputOption::VALUE_REQUIRED, 'Log duplicates in JUnit XML format to defined file.')
->setDescription('Find duplicate files in your theme')
->setDescription('Find duplicate files (templates, layout, locale, etc.) between two themes.')
;

$help = <<<HELP
* If a filename with `--log-junit` option is set the tool generates an XML file and no output to *stdout*.
HELP;
$this->setHelp($help);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/N98/Magento/Command/Indexer/ListCommand.php
Expand Up @@ -15,6 +15,11 @@ protected function configure()
->setName('index:list')
->setDescription('Lists all magento indexes')
;

$help = <<<HELP
Lists all Magento indexers of current installation.
HELP;

}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/N98/Magento/Command/Indexer/ReindexAllCommand.php
Expand Up @@ -15,6 +15,8 @@ protected function configure()
->setName('index:reindex:all')
->setDescription('Reindex all magento indexes')
;

$this->setHelp('Loops all magento indexes and triggers reindex.');
}

/**
Expand Down
17 changes: 17 additions & 0 deletions src/N98/Magento/Command/Indexer/ReindexCommand.php
Expand Up @@ -16,6 +16,23 @@ protected function configure()
->addArgument('index_code', InputArgument::OPTIONAL, 'Code of indexer.')
->setDescription('Reindex a magento index by code')
;

$help = <<<HELP
Index by indexer code. Code is optional. If you don't specify a code you can pick a indexer from a list.
$ n98-magerun.phar index:reindex [code]
Since 1.75.0 it's possible to run mutiple indexers by seperating code with a comma.
i.e.
$ n98-magerun.phar index:reindex catalog_product_attribute,tag_summary
If no index is provided as argument you can select indexers from menu by "number" like "1,3" for first and third
indexer.
HELP;
$this->setHelp($help);
}

/**
Expand Down
16 changes: 16 additions & 0 deletions src/N98/Magento/Command/Installer/InstallCommand.php
Expand Up @@ -51,6 +51,22 @@ protected function configure()
->setDescription('Install magento')
;

$help = <<<HELP
* Download Magento by a list of git repos and zip files (mageplus, magelte, official community packages).
* Try to create database if it does not exist.
* Installs Magento sample data if available (since version 1.2.0).
* Starts Magento installer
* Sets rewrite base in .htaccess file
Example of an unattended Magento CE 1.7.0.2 installation:
$ n98-magerun.phar install --dbHost="localhost" --dbUser="mydbuser" --dbPass="mysecret" --dbName="magentodb" --installSampleData=yes --useDefaultConfigParams=yes --magentoVersionByName="magento-ce-1.7.0.2" --installationFolder="magento" --baseUrl="http://magento.localdomain/"
See it in action: http://youtu.be/WU-CbJ86eQc
HELP;
$this->setHelp($help);

$this->notEmptyCallback = function($input)
{
if (empty($input)) {
Expand Down

0 comments on commit 2805f04

Please sign in to comment.