Skip to content

Commit

Permalink
Merge pull request #7757 from kenjis/docs-console-command
Browse files Browse the repository at this point in the history
docs: remove `>` in console command
  • Loading branch information
kenjis authored Aug 2, 2023
2 parents c56edf2 + a6acb4f commit 18487ea
Show file tree
Hide file tree
Showing 32 changed files with 345 additions and 170 deletions.
13 changes: 13 additions & 0 deletions contributing/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,16 @@ As a general rule, we use ``**`` for in-line file paths, and `````` for source c
E.g.::

Open the **app/Config/Filters.php** file and update the ``$methods`` property like the following:

**********
Code Block
**********

CLI Command
===========

::

.. code-block:: console

php spark migrate
4 changes: 4 additions & 0 deletions user_guide_src/source/_static/css/citheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(
margin-top: 2rem;
}

.highlight-console .highlight {
background-color: #fffff0;
}

/* Messages ----------------------------------------------------------------- */

.rst-content .success {
Expand Down
4 changes: 4 additions & 0 deletions user_guide_src/source/_static/css/citheme_dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,8 @@
.highlight .ni {
color: #b780b7;
}

.highlight-console .highlight pre {
background: #434343;
}
}
6 changes: 4 additions & 2 deletions user_guide_src/source/cli/cli_commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ run()
-----

The ``run()`` method is the method that is called when the command is being run. The ``$params`` array is a list of
any CLI arguments after the command name for your use. If the CLI string was::
any CLI arguments after the command name for your use. If the CLI string was:

> php spark foo bar baz
.. code-block:: console
php spark foo bar baz
Then **foo** is the command name, and the ``$params`` array would be:

Expand Down
12 changes: 8 additions & 4 deletions user_guide_src/source/cli/cli_generators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ Introduction
************

All built-in generators reside under the ``Generators`` group when listed using ``php spark list``.
To view the full description and usage information on a particular generator, use the command::
To view the full description and usage information on a particular generator, use the command:

> php spark help <generator_command>
.. code-block:: console
php spark help <generator_command>
where ``<generator_command>`` will be replaced with the command to check.

Expand Down Expand Up @@ -287,9 +289,11 @@ wrapper to the controller, model, entity, migration, and seeder generator comman
name that will be used to name all the generated classes. Also, **individual options** supported by each
generator command are recognized by the scaffold command.

Running this in your terminal::
Running this in your terminal:

.. code-block:: console
> php spark make:scaffold user
php spark make:scaffold user
will create the following files:

Expand Down
6 changes: 4 additions & 2 deletions user_guide_src/source/cli/cli_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ The Spark Commands

CodeIgniter ships with the official command **spark** and built-in commands.

You can run the spark and see the help::
You can run the spark and see the help:

> php spark
.. code-block:: console
php spark
See the :doc:`spark_commands` page for detailed information.

Expand Down
60 changes: 40 additions & 20 deletions user_guide_src/source/cli/spark_commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,66 +23,86 @@ Showing List of Commands

When called **spark** without specifying a command, a simple help page is displayed
that also provides a list of available commands and their descriptions, sorted by
categories::
categories:

> php spark
.. code-block:: console
php spark
spark list
^^^^^^^^^^

``php spark`` is the exactly same as the ``list`` command::
``php spark`` is the exactly same as the ``list`` command:

.. code-block:: console
> php spark list
php spark list
You may also use the ``--simple`` option to get a raw list of all available commands,
sorted alphabetically::
sorted alphabetically:

.. code-block:: console
> php spark list --simple
php spark list --simple
Showing Help
------------

You can get help about any CLI command using the ``help`` command as follows::
You can get help about any CLI command using the ``help`` command as follows:

.. code-block:: console
php spark help db:seed
> php spark help db:seed
Since v4.3.0, you can also use the ``--help`` option instead of the ``help`` command:

Since v4.3.0, you can also use the ``--help`` option instead of the ``help`` command::
.. code-block:: console
> php spark db:seed --help
php spark db:seed --help
Running a Command
-----------------

You should pass the name of the command as the first argument to run that command::
You should pass the name of the command as the first argument to run that command:

> php spark migrate
.. code-block:: console
Some commands take additional arguments, which should be provided directly after the command, separated by spaces::
php spark migrate
> php spark db:seed DevUserSeeder
Some commands take additional arguments, which should be provided directly after the command, separated by spaces:

.. code-block:: console
php spark db:seed DevUserSeeder
For all of the commands CodeIgniter provides, if you do not provide the required arguments, you will be prompted
for the information it needs to run correctly::
for the information it needs to run correctly:

.. code-block:: console
> php spark make:controller
php spark make:controller
Controller class name :
Suppressing Header Output
-------------------------

When you run a command, the header with CodeIgniter version and the current time
is output::
is output:

> php spark env
.. code-block:: console
php spark env
CodeIgniter v4.3.5 Command Line Tool - Server Time: 2023-06-16 12:45:31 UTC+00:00
Your environment is currently set as development.
You may always pass ``--no-header`` to suppress the header output, helpful for parsing results::
You may always pass ``--no-header`` to suppress the header output, helpful for parsing results:

.. code-block:: console
> php spark env --no-header
php spark env --no-header
Your environment is currently set as development.
Expand Down
6 changes: 4 additions & 2 deletions user_guide_src/source/concepts/autoloader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ those classes can be found in:
The key of each row is the namespace itself. This does not need a trailing back slash.
The value is the location to the directory the classes can be found in.

.. note:: You can check the namespace configuration by ``spark namespaces`` command::
.. note:: You can check the namespace configuration by ``spark namespaces`` command:

> php spark namespaces
.. code-block:: console
php spark namespaces
By default, the application directory is namespace to the ``App`` namespace. You must namespace the controllers,
libraries, or models in the application directory, and they will be found under the ``App`` namespace.
Expand Down
30 changes: 20 additions & 10 deletions user_guide_src/source/dbmgmt/db_commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ db:table --show
---------------

To list all the tables in your database straight from your favorite terminal,
you can use the ``db:table --show`` command::
you can use the ``db:table --show`` command:

> php spark db:table --show
.. code-block:: console
php spark db:table --show
When using this command it is assumed that a table exists.
Otherwise, CodeIgniter will complain that the database has no tables.
Expand All @@ -32,21 +34,27 @@ Retrieve Some Records
db:table
--------

When you have a table named ``my_table``, you can see the field names and the records of a table::
When you have a table named ``my_table``, you can see the field names and the records of a table:

.. code-block:: console
> php spark db:table my_table
.. code-block:: consolephp spark db:table my_table
If the table ``my_table`` is not in the database, CodeIgniter displays a list of available tables to select.

You can also use the following command without the table name::
You can also use the following command without the table name:

.. code-block:: console
> php spark db:table
php spark db:table
In this case, the table name will be asked.

You can also pass a few options::
You can also pass a few options:

> php spark db:table my_table --limit-rows 50 --limit-field-value 20 --desc
.. code-block:: console
php spark db:table my_table --limit-rows 50 --limit-field-value 20 --desc
The option ``--limit-rows 50`` limits the number of rows to 50 rows.

Expand All @@ -60,9 +68,11 @@ Retrieve Field Metadata
db:table --metadata
-------------------

When you have a table named ``my_table``, you can see metadata like the column type, max length of the table with the ``--metadata`` option::
When you have a table named ``my_table``, you can see metadata like the column type, max length of the table with the ``--metadata`` option:

.. code-block:: console
> php spark db:table my_table --metadata
php spark db:table my_table --metadata
When using this command it is assumed that the table exists.
Otherwise, CodeIgniter will show a table list to select.
Expand Down
15 changes: 10 additions & 5 deletions user_guide_src/source/dbmgmt/forge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,24 @@ CodeIgniter supports creating databases straight from your favorite terminal usi
command. By using this command it is assumed that the database is not yet existing. Otherwise, CodeIgniter
will complain that the database creation has failed.

To start, just type the command and the name of the database (e.g., ``foo``)::
To start, just type the command and the name of the database (e.g., ``foo``):

> php spark db:create foo
.. code-block:: console
php spark db:create foo
If everything went fine, you should expect the ``Database "foo" successfully created.`` message displayed.

If you are on a testing environment or you are using the SQLite3 driver, you may pass in the file extension
for the file where the database will be created using the ``--ext`` option. Valid values are ``db`` and
``sqlite`` and defaults to ``db``. Remember that these should not be preceded by a period.
::
:

.. code-block:: console
php spark db:create foo --ext sqlite
> php spark db:create foo --ext sqlite
// will create the db file in WRITEPATH/foo.sqlite
The above command will create the db file in **WRITEPATH/foo.sqlite**.

.. note:: When using the special SQLite3 database name ``:memory:``, expect that the command will still
produce a success message but no database file is created. This is because SQLite3 will just use
Expand Down
44 changes: 29 additions & 15 deletions user_guide_src/source/dbmgmt/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,31 @@ that wish to use them. The tools primarily provide access to the same methods th
migrate
=======

Migrates a database group with all available migrations::
Migrates a database group with all available migrations:

> php spark migrate
.. code-block:: console
php spark migrate
You can use (migrate) with the following options:

- ``-g`` - to chose database group, otherwise default database group will be used.
- ``-n`` - to choose namespace, otherwise (App) namespace will be used.
- ``--all`` - to migrate all namespaces to the latest migration.

This example will migrate ``Acme\Blog`` namespace with any new migrations on the test database group::
This example will migrate ``Acme\Blog`` namespace with any new migrations on the test database group:

For Unix:

.. code-block:: console
php spark migrate -g test -n Acme\\Blog
For Unix:
> php spark migrate -g test -n Acme\\Blog
For Windows:

For Windows:
> php spark migrate -g test -n Acme\Blog
.. code-block:: console
php spark migrate -g test -n Acme\Blog
When using the ``--all`` option, it will scan through all namespaces attempting to find any migrations that have
not been run. These will all be collected and then sorted as a group by date created. This should help
Expand All @@ -132,9 +140,11 @@ to minimize any potential conflicts between the main application and any modules
rollback
========

Rolls back all migrations, taking the database group to a blank slate, effectively migration 0::
Rolls back all migrations, taking the database group to a blank slate, effectively migration 0:

.. code-block:: console
> php spark migrate:rollback
php spark migrate:rollback
You can use (rollback) with the following options:

Expand All @@ -145,9 +155,11 @@ You can use (rollback) with the following options:
refresh
=======

Refreshes the database state by first rolling back all migrations, and then migrating all::
Refreshes the database state by first rolling back all migrations, and then migrating all:

> php spark migrate:refresh
.. code-block:: console
php spark migrate:refresh
You can use (refresh) with the following options:

Expand All @@ -159,9 +171,11 @@ You can use (refresh) with the following options:
status
======

Displays a list of all migrations and the date and time they ran, or '--' if they have not been run::
Displays a list of all migrations and the date and time they ran, or '--' if they have not been run:

.. code-block:: console
> php spark migrate:status
php spark migrate:status
...
Expand All @@ -184,9 +198,9 @@ Creates a skeleton migration file in **app/Database/Migrations**.
It automatically prepends the current timestamp. The class name it
creates is the Pascal case version of the filename.

::
.. code-block:: console
> php spark make:migration <class> [options]
php spark make:migration <class> [options]
You can use (``make:migration``) with the following options:

Expand Down
Loading

0 comments on commit 18487ea

Please sign in to comment.