Skip to content

Instantly share code, notes, and snippets.

@msonnabaum
Created January 18, 2012 14:59
Show Gist options
  • Save msonnabaum/1633377 to your computer and use it in GitHub Desktop.
Save msonnabaum/1633377 to your computer and use it in GitHub Desktop.
<?php
$commands = drush_get_commands();
foreach ($commands as $name => $command) {
$output = theme_drush_command_docs($command);
file_put_contents("{$name}.md", $output);
}
function theme_drush_command_docs($command) {
$output = "#{$command['command']}";
foreach ($command['arguments'] as $arg => $desc) {
$output .= "\n## Arguments";
$output .= "\n* {$arg}: {$desc}";
}
foreach ($command['options'] as $option => $desc) {
$output .= "\n## Options";
$output .= "\n* {$option}: {$desc}";
}
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment