Skip to content

Commit

Permalink
More terse Attributes example and Add last-updated date and authors t…
Browse files Browse the repository at this point in the history
…o bottom of all docs pages. (#4958)

* Slightly more terse docs for Attributes

* Add last-updated date and authors to bottom of all docs pages.
  • Loading branch information
weitzman committed Dec 30, 2021
1 parent 4b96291 commit 1090847
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Build static sites

# Controls when the action will run. Triggers the workflow on push or pull request
# Controls when the action will run. Triggers the workflow on push
# events but only for the 11.x branch
on:
push:
branches: [11.x]
# pull_request:
# branches: [11.x]

jobs:
build:
Expand All @@ -21,6 +19,7 @@ jobs:
with:
ref: gh-pages
path: gh-pages
fetch-depth: 0

- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand All @@ -30,7 +29,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs-material pymdown-extensions git+https://gitlab.com/blacs30/mkdocs-edit-url.git
pip install mkdocs-material mkdocs-git-authors-plugin mkdocs-git-revision-date-localized-plugin pymdown-extensions git+https://gitlab.com/blacs30/mkdocs-edit-url.git
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
28 changes: 15 additions & 13 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ The following are both valid ways to declare a command:

=== "PHP8 Attributes"

```php8
#[Command(name: 'xkcd:fetch-attributes', aliases: ['xkcd-attributes'])]
#[Argument(name: 'search', description: 'Optional argument to retrieve the cartoons matching an index number, keyword search or "random". If omitted the latest cartoon will be retrieved.')]
#[Option(name: 'image-viewer', description: 'Command to use to view images (e.g. xv, firefox). Defaults to "display" (from ImageMagick).')]
#[Option(name: 'google-custom-search-api-key', description: 'Google Custom Search API Key, available from https://code.google.com/apis/console/. Default key limited to 100 queries/day globally.')]
#[Help(description: 'Retrieve and display xkcd cartoons (attribute variant).')]
#[Usage(name: 'drush xkcd', description: 'Retrieve and display the latest cartoon')]
#[Usage(name: 'drush xkcd sandwich', description: 'Retrieve and display cartoons about sandwiches.')]
public function fetch($search = null, $options = ['image-viewer' => 'open', 'google-custom-search-api-key' => 'AIzaSyDpE01VDNNT73s6CEeJRdSg5jukoG244ek']) {
```php
use Drush\Attributes as CLI;

#[CLI\Command(name: 'xkcd:fetch-attributes', aliases: ['xkcd-attributes'])]
#[CLI\Argument(name: 'search', description: 'Optional argument to retrieve the cartoons matching an index, keyword keyword, or "random".')]
#[CLI\Option(name: 'image-viewer', description: 'Command to use to view images (e.g. xv, firefox).')]
#[CLI\Option(name: 'google-custom-search-api-key', description: 'Google Custom Search API Key')]
#[CLI\Help(description: 'Retrieve and display xkcd cartoons (attribute variant).')]
#[CLI\Usage(name: 'drush xkcd', description: 'Retrieve and display the latest cartoon')]
#[CLI\Usage(name: 'drush xkcd sandwich', description: 'Retrieve and display cartoons about sandwiches.')]
public function fetch($search = null, $options = ['image-viewer' => 'open', 'google-custom-search-api-key' => 'AIza']) {
$this->doFetch($search, $options);
}
```
Expand All @@ -35,16 +37,16 @@ The following are both valid ways to declare a command:
```php
/**
* @command xkcd:fetch
* @param $search Optional argument to retrieve the cartoons matching an index number, keyword search or "random". If omitted the latest cartoon will be retrieved.
* @option image-viewer Command to use to view images (e.g. xv, firefox). Defaults to "display" (from ImageMagick).
* @option google-custom-search-api-key Google Custom Search API Key, available from https://code.google.com/apis/console/. Default key limited to 100 queries/day globally.
* @param $search Optional argument to retrieve the cartoons matching an index number, keyword, or "random".
* @option image-viewer Command to use to view images (e.g. xv, firefox).
* @option google-custom-search-api-key Google Custom Search API Key.
* @usage drush xkcd
* Retrieve and display the latest cartoon.
* @usage drush xkcd sandwich
* Retrieve and display cartoons about sandwiches.
* @aliases xkcd
*/
public function fetch($search = null, $options = ['image-viewer' => 'open', 'google-custom-search-api-key' => 'AIzaSyDpE01VDNNT73s6CEeJRdSg5jukoG244ek']) {
public function fetch($search = null, $options = ['image-viewer' => 'open', 'google-custom-search-api-key' => 'AIza']) {
$this->doFetch($search, $options);
}
```
Expand Down
13 changes: 13 additions & 0 deletions docs/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@
<meta name="twitter:image" content="https://raw.githubusercontent.com/drush-ops/drush/10.x/drush_logo-black.png" />
{% endblock %}

<!-- https://timvink.github.io/mkdocs-git-authors-plugin/usage.html -->
{% block content %}
{{ super() }}

{% if git_page_authors %}
<div class="md-source-date">
<small>
Authors: {{ git_page_authors | default('enable mkdocs-git-authors-plugin') }}
</small>
</div>
{% endif %}
{% endblock %}

{% block disqus %}
<script src="https://cdn.fastcomments.com/js/embed.min.js"></script>
<div id="fastcomments-widget"></div>
Expand Down
5 changes: 5 additions & 0 deletions mkdocs_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ extra_css:
plugins:
- edit_url
- search
- git-revision-date-localized
- git-authors:
exclude:
- commands/*
- generators/*
extra:
social:
- icon: fontawesome/brands/twitter
Expand Down

0 comments on commit 1090847

Please sign in to comment.