【Laravel】artisanのlistコマンドを解説

チートシート

Laravel 10.x以降のartisanの「list」コマンドを解説します。

Description

コマンド一覧を表示します。

Usage

php artisan list [--raw] [--format FORMAT] [--short] [--] [<namespace>]

Arguments

引数必須説明
namespace-ネームスペース

Options

オプション省略形必須説明
raw--1行に1コマンドのリストを出力します / To output raw command list
format-必須出力形式を指定します(デフォルトはtxt) / The output format (txt, xml, json, or md) [default: "txt"]
short--コマンドの引数説明を省略します / To skip describing commands' arguments

Example

no options

オプションなしの場合

php artisan list
Laravel Framework 10.4.1

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  about                   Display basic information about your application
  clear-compiled          Remove the compiled class file
  completion              Dump the shell completion script
  db                      Start a new database CLI session
  :
  :

raw

php artisan list --raw
about                    Display basic information about your application
clear-compiled           Remove the compiled class file
completion               Dump the shell completion script
db                       Start a new database CLI session
:
:

format

jsonを指定すると、json形式で出力されます。

php artisan list --format=json key
{"application":{"name":"Laravel Framework","version":"10.4.1"},"commands":[{"name":"key:generate","description":"Set the application key","usage":["key:generate [--show] [--force]"],"help":"Set the application key","definition":{"arguments":[],"options":{"show":{"name":"--show","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display the key instead of modifying files","default":false},"force":{"name":"--force","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force the operation to run when in production","default":false},"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display help for the given command. When no command is given display help for the <info>list<\/info> command","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force (or disable --no-ansi) ANSI output","default":null},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Negate the \"--ansi\" option","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question","default":false},"env":{"name":"--env","shortcut":"","accept_value":true,"is_value_required":false,"is_multiple":false,"description":"The environment the command should run under","default":null}}},"hidden":false}],"namespace":"key"}

mdを指定すると、Markdown形式で出力されます。

php artisan list --format=md key
Laravel Framework 10.4.1
========================

**key:**

* [`key:generate`](#keygenerate)

`key:generate`
--------------

Set the application key

### Usage

* `key:generate [--show] [--force]`

Set the application key

### Options

#### `--show`

Display the key instead of modifying files

* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
:
:

namespace

php artisan list --raw db
db:monitor   Monitor the number of connections on the specified database
db:seed      Seed the database with records
db:show      Display information about the given database
db:table     Display information about the given database table
db:wipe      Drop all tables, views, and types

コメント

タイトルとURLをコピーしました