Skip to content

Commit 67a8168

Browse files
authored
Merge pull request #273 from awvwgk/dev-docs
Update developer documentation (manifest + command line)
2 parents 447b4b2 + f17591b commit 67a8168

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

docs.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,56 @@ sort: permission-alpha
2424
favicon: doc/media/favicon.ico
2525
print_creation_date: true
2626
extra_mods: iso_fortran_env:https://gcc.gnu.org/onlinedocs/gfortran/ISO_005fFORTRAN_005fENV.html
27+
tomlf:https://toml-f.github.io/toml-f
28+
M_CLI2:https://github.com/urbanjost/M_CLI2
2729
creation_date: %Y-%m-%d %H:%M %z
2830
md_extensions: markdown.extensions.toc
2931
markdown.extensions.smarty
3032
---
3133

3234
[TOC]
35+
36+
# Fortran package manager developer documentation
37+
38+
This is the main documentation of the Fortran package manager (*fpm*).
39+
This document serves as developer documentation of *fpm* itself and contains general advice for developing in the *fpm* code base.
40+
41+
42+
## The package manifest
43+
44+
The central object describing an *fpm* project is the package manifest ``fpm.toml``.
45+
The manifest is written in TOML, you can find the TOML specification at the official [TOML homepage](https://toml.io).
46+
47+
The ``fpm.toml`` file targets project developers and maintainers to relieve them from writing build files for their packages.
48+
With the package manifest a central place to collect information about the project is provided.
49+
It contains the versioning and licensing meta data, as well as the information on external dependencies and the required build-tools or compiler settings.
50+
51+
The manifest format specific to *fpm* projects is documented in the [manifest reference](page/Manifest.html).
52+
53+
@Note For a more practical but less complete guide on creating *fpm* projects see the [packaging guide](page/Packaging.html).
54+
55+
The details of the TOML parsing are implemented with using the [tomlf](https://toml-f.github.io/toml-f) module.
56+
Generally, the interface to all TOML related functions for *fpm* is found in the proxy module [[fpm_toml]].
57+
58+
All the manifest types are bundled in [[fpm_manifest]].
59+
While the specific subtables for the package configuration are found in the ``src/fpm/manifest`` directory, they should be reexported in the [[fpm_manifest]] module if they should be elsewhere in *fpm*.
60+
61+
62+
## Command line interface
63+
64+
*fpm* is mainly used as a command line tool.
65+
To work with an *fpm* project as a user you can completely rely on the command line.
66+
67+
The command line interface is build with the [M_CLI2](https://github.com/urbanjost/M_CLI2) module and can be found in [[fpm_command_line]].
68+
69+
70+
## Generating this documentation
71+
72+
This documentation is generated by [FORD](https://github.com/Fortran-FOSS-Programmers/FORD).
73+
For more details on the [project file](https://github.com/fortran-lang/fpm/docs.md) and the comment markup in the source code visit the [FORD documentation](https://github.com/Fortran-FOSS-Programmers/ford/wiki).
74+
75+
To regenerate this documentation run:
76+
77+
```shell
78+
ford docs.md
79+
```

fpm/src/fpm/toml.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
!> Interface to TOML processing library.
1+
!># Interface to TOML processing library
22
!>
33
!> This module acts as a proxy to the `toml-f` public Fortran API and allows
44
!> to selectively expose components from the library to `fpm`.
@@ -10,7 +10,8 @@
1010
!> This module allows to implement features necessary for `fpm`, which are
1111
!> not yet available in upstream `toml-f`.
1212
!>
13-
!> For more details on the library used see: https://toml-f.github.io/toml-f
13+
!> For more details on the library used see the
14+
!> [TOML-Fortran](https://toml-f.github.io/toml-f) developer pages.
1415
module fpm_toml
1516
use fpm_error, only : error_t, fatal_error, file_not_found_error
1617
use fpm_strings, only : string_t

fpm/src/fpm_command_line.f90

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
!># Definition of the command line interface
2+
!>
3+
!> This module uses [M_CLI2](https://github.com/urbanjost/M_CLI2) to define
4+
!> the command line interface.
5+
!> To define a command line interface create a new command settings type
6+
!> from the [[fpm_cmd_settings]] base class or the respective parent command
7+
!> settings.
8+
!>
9+
!> The subcommand is selected by the first non-option argument in the command
10+
!> line. In the subcase block the actual command line is defined and transferred
11+
!> to an instance of the [[fpm_cmd_settings]], the actual type is used by the
12+
!> *fpm* main program to determine which command entry point is chosen.
13+
!>
14+
!> To add a new subcommand add a new case to select construct and specify the
15+
!> wanted command line and the expected default values.
16+
!> Some of the following points also apply if you add a new option or argument
17+
!> to an existing *fpm* subcommand.
18+
!> Add this point you should create a help page for the new command in a simple
19+
!> catman-like format as well in the ``set_help`` procedure.
20+
!> Make sure to register new subcommands in the ``fpm-manual`` command by adding
21+
!> them to the manual character array and in the help/manual case as well.
22+
!> You should add the new command to the synopsis section of the ``fpm-list``,
23+
!> ``fpm-help`` and ``fpm --list`` help pages below to make sure the help output
24+
!> is complete and consistent as well.
125
module fpm_command_line
226
use fpm_environment, only : get_os_type, get_env, &
327
OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_WINDOWS, &

0 commit comments

Comments
 (0)