Skip to content

Commit

Permalink
website: add _xpack.github.io with the jekyll content
Browse files Browse the repository at this point in the history
  • Loading branch information
ilg-ul committed Dec 8, 2024
1 parent c328614 commit ea607c2
Show file tree
Hide file tree
Showing 17 changed files with 2,219 additions and 0 deletions.
137 changes: 137 additions & 0 deletions website/_xpack.github.io/core/xpm/cli/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
title: xpm - common options
permalink: /xpm/cli/

comments: true

date: 2017-10-09 12:50:00 +0300

---

## Synopsis

```sh
xpm <command> [<subcommand>...] [<options> ...] [<args>...]
```

## Description

`xpm` is the xPacks project manager. It manages dependencies
and puts xPacks in known places so that builds can find them.

{% include note.html content="`xpm` is an extension of
[npm](https://docs.npmjs.com/cli/npm.html) and
uses the same public registry at https://registry.npmjs.org." %}

The program accepts a command name, possibly one or more subcommand
names, options (that start with a dash) and possibly one or more
arguments, like names, files, etc.

The list of accepted options and arguments is specific to a given
command, or set of command and subcommands.

## Common options

### Help (`-h|--help`)

To get an initial glimpse on the program, ask for help:

```console
$ xpm --help

The xPack package manager command line tool
Usage: xpm <command> [<subcommand>...] [<options> ...] [<args>...]

where <command> is one of:
init, install, link, list, run, uninstall

Common options:
--loglevel <level> Set log level (silent|warn|info|verbose|debug|trace)
-s|--silent Disable all messages (--loglevel silent)
-q|--quiet Mostly quiet, warnings and errors (--loglevel warn)
--informative Informative (--loglevel info)
-v|--verbose Verbose (--loglevel verbose)
-d|--debug Debug messages (--loglevel debug)
-dd|--trace Trace messages (--loglevel trace, -d -d)
--no-update-notifier Skip check for a more recent version
-C <folder> Set current folder

xpm -h|--help Quick help
xpm <command> -h|--help Quick help on command
xpm --version Show version
xpm -i|--interactive Enter interactive mode

npm [email protected] '/Users/ilg/.nvm/versions/node/v14.16.0/lib/node_modules/xpm'
Home page: <https://xpack.github.io/xpm/>
Bug reports: <https://github.com/xpack/xpm-js/issues/>
```

This works both at top level and with commands/subcommands.

### Log level (`--loglevel`)

The default behaviour of the program is to display only a minimum
amount of messages.

This can be changed, from not displaying any messages at all (`--silent`)
to displaying lots of debugging trace messages (`--trace`).

```console
--loglevel <level> Set log level (silent|warn|info|verbose|debug|trace)
-s|--silent Disable all messages (--loglevel silent)
-q|--quiet Mostly quiet, warnings and errors (--loglevel warn)
--informative Informative (--loglevel info)
-v|--verbose Verbose (--loglevel verbose)
-d|--debug Debug messages (--loglevel debug)
-dd|--trace Trace messages (--loglevel trace, -d -d)
```

### Current folder (`-C`)

By default the program is executed in the context of the current shell
folder, but it can be changed to any folder using `-C <folder>`.

### Program version (`--version`)

As for most command line tools, it is possible to ask for the current
version, with `--version`:

```console
$ xpm --version
0.9.0
```

The result is written to the standard output stream, and consists of the
semver string, without any `v` prefix, so it can be directly used in
automated scripts, without any post processing.

### Skip checks (`--no-update-notifier`)

By default, before exiting, `xpm` checks, once a day, if there is a
new version of the program available.

For environments where this check is not necessary, it can be disabled.

### Interactive mode (`-i|--interactive`)

The common use case is to start the program for each single command.

It is also possible to start the program with a prompt, and issue as many
commands as needed.

```console
$ xpm -i
xpm> version
0.9.0
xpm>
...
```

## Commands

- [`xpm init`]({{ site.baseurl }}/xpm/cli/init/)
- [`xpm install`]({{ site.baseurl }}/xpm/cli/install/)
- [`xpm link`]({{ site.baseurl }}/xpm/cli/link/)
- [`xpm list`]({{ site.baseurl }}/xpm/cli/list/)
- [`xpm run`]({{ site.baseurl }}/xpm/cli/run/)
- [`xpm uninstall`]({{ site.baseurl }}/xpm/cli/uninstall/)
172 changes: 172 additions & 0 deletions website/_xpack.github.io/core/xpm/cli/init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
---
permalink: /xpm/cli/init/
title: xpm init

comments: true

date: 2017-10-09 12:55:00 +0300

---

## Synopsis

```sh
xpm init [options...] [--template <xpack>] [--name <string>]
[--property <string>]*
```

Aliases:

- `ini`

## Description

Initialise the current folder as an xPack, by creating a skeleton
`package.json` file. This file needs further editing to update most
of the objects.

If called with a template, use the template and create a custom
project with as many files and folders as necessary.

{% include note.html content="The current behaviour may change,
the template API is not yet final." %}

## Options

### Help (`--help`)

```console
$ xpm init --help

xPack manager - create an xPack, empty or from a template
Usage: xpm init [options...] [--template <xpack>] [--name <string>]
[--property <string>]*

Init options:
-t|--template <xpack> The xPack implementing the template (optional)
-n|--name <string> Project name (optional)
-p|--property <string> Substitution variables (optional, multiple)

Common options:
--loglevel <level> Set log level (silent|warn|info|verbose|debug|trace)
-s|--silent Disable all messages (--loglevel silent)
-q|--quiet Mostly quiet, warnings and errors (--loglevel warn)
--informative Informative (--loglevel info)
-v|--verbose Verbose (--loglevel verbose)
-d|--debug Debug messages (--loglevel debug)
-dd|--trace Trace messages (--loglevel trace, -d -d)
--no-update-notifier Skip check for a more recent version
-C <folder> Set current folder

xpm -h|--help Quick help
xpm --version Show version
xpm -i|--interactive Enter interactive mode

npm [email protected] '/Users/ilg/.nvm/versions/node/v14.16.0/lib/node_modules/xpm'
Home page: <https://xpack.github.io/xpm/>
Bug reports: <https://github.com/xpack/xpm-js/issues/>
$
```

### Template (`-t|--template <xpack>`)

Create the xPack using a template. The template itself is an xPack
with a specific code that implements a template API.

Example: Create a project in an interactive session by answering
lots of questions:

```console
$ xpm init --template @sifive/templates --verbose
xPack manager - create an xPack, empty or from a template

Processing @sifive/[email protected]...

Programming language? (c, cpp, ?) [cpp]:
Board? (hifive1, e31arty, e51arty, ?) [hifive1]:
Content? (empty, blinky, ?) [blinky]:
Use system calls? (none, retarget, semihosting, ?) [retarget]:
Trace output? (none, uart0ftdi, stdout, debug, ?) [uart0ftdi]:
Check some warnings? (true, false, ?) [true]:
Check most warnings? (true, false, ?) [false]:
Enable -Werror? (true, false, ?) [false]:
Use -Og on debug? (true, false, ?) [false]:
Use newlib nano? (true, false, ?) [true]:

Creating the C++ project 'hifive1-blinky-cpp'...
File 'LICENSE' generated.
File 'oocd.launch' generated.
File 'jlink.launch' generated.
File 'package.json' generated.
File 'README.md' generated.
File 'xmake.json' generated.
File 'include/led.h' generated.
File 'include/sysclock.h' copied.
File 'ldscripts/libs.ld' copied.
File 'ldscripts/mem.ld' copied.
File 'ldscripts/sections.ld' copied.
File 'src/initialize-hardware.cpp' generated.
File 'src/interrupts-handlers.cpp' generated.
File 'src/led.cpp' copied.
File 'src/main.cpp' generated.
File 'src/newlib-syscalls.c' copied.
File 'src/sysclock.cpp' copied.

'xpm init' completed in 77 ms.
$
```

### Name (`--name <string>`)

Define a name for the new xPack. If missing, the xPack name is
derived from the current folder name.

### Properties (`-p|--property <string>`)

Pass pairs of `name=value` properties to the template engine. Multiple
properties can be defined.

The names, values and behaviours are all specific to each template engine.

Example: the same template as before, if it receives a mandatory
`boardName` property,
can create the new xPack without further questions, by using defaults:

```console
$ xpm init --template @sifive/templates --property boardName=hifive1
xPack manager - create an xPack, empty or from a template

Processing @sifive/[email protected]...

Creating the C++ project 'hifive1-blinky-cpp'...
- boardName=hifive1
- content=blinky
- syscalls=retarget
- trace=uart0ftdi
- useSomeWarnings=true
- useMostWarnings=false
- useWerror=false
- useOg=false
- useNano=true

File 'LICENSE' generated.
File 'oocd.launch' generated.
File 'jlink.launch' generated.
File 'package.json' generated.
File 'README.md' generated.
File 'xmake.json' generated.
File 'include/led.h' generated.
File 'include/sysclock.h' copied.
File 'ldscripts/libs.ld' copied.
File 'ldscripts/mem.ld' copied.
File 'ldscripts/sections.ld' copied.
File 'src/initialize-hardware.cpp' generated.
File 'src/interrupts-handlers.cpp' generated.
File 'src/led.cpp' copied.
File 'src/main.cpp' generated.
File 'src/newlib-syscalls.c' copied.
File 'src/sysclock.cpp' copied.

'xpm init' completed in 1.144 sec.
$
```
Loading

0 comments on commit ea607c2

Please sign in to comment.