Command-line interface#

Shared command-line interface#

swh#

Command line interface for Software Heritage.

swh [OPTIONS] COMMAND [ARGS]...

Options

-l, --log-level <log_levels>#

Log level (defaults to INFO). Can override the log level for a specific module, by using the specific.module:LOGLEVEL syntax (e.g. --log-level swh.core:DEBUG will enable DEBUG logging for swh.core).

--log-config <log_config>#

Python yaml logging configuration file.

--sentry-dsn <sentry_dsn>#

DSN of the Sentry instance to report to

Environment variables

SWH_LOG_LEVEL

Provide a default for --log-level

Commands

alter

Archive alteration tools.

auth

Software Heritage Authentication tools.

counters

Software Heritage Counters tools.

dataset

Dataset Tools.

db

Software Heritage database generic tools.

deposit

Deposit main command

fs

Software Heritage virtual file system

graph

Software Heritage graph tools.

identify

Compute the Software Heritage persistent…

indexer

Software Heritage Indexer tools.

lister

Software Heritage Lister tools.

loader

Loader cli tools

metadata-loader

Software Heritage Metadata Loader.

nar

Compute NAR hashes on a directory.

objstorage

Software Heritage Objstorage tools.

scanner

Software Heritage Scanner tools.

scheduler

Software Heritage Scheduler tools.

scrubber

main command group of the datastore scrubber

search

Software Heritage Search tools.

storage

Software Heritage Storage tools.

vault

Software Heritage Vault tools.

web

Software Heritage web client

webhooks

Software Heritage Webhooks management…

Database initialization utilities#

swh db init#

Initialize a database for the Software Heritage <module>.

The database connection string can come from the –dbname option, or from the configuration file (see option --config-file in swh db --help) in the section named after the MODULE argument.

Example:


$ cat conf.yml
storage:
  cls: postgresql
  db: postgresql://user:passwd@pghost:5433/swh-storage
  objstorage:
    cls: memory


$ swh db -C conf.yml init storage  # or
$ SWH_CONFIG_FILENAME=conf.yml swh db init storage
$ # or
$ swh db init --dbname postgresql://user:passwd@pghost:5433/swh-storage storage
swh db init [OPTIONS] MODULE

Options

-d, --dbname, --db-name <dbname>#

Database name or connection URI.

--flavor <flavor>#

Database flavor.

Arguments

MODULE#

Required argument

swh db-init#

Initialize a database for the Software Heritage <module>.

The database connection string can come from the –dbname option, or from the configuration file (see option --config-file in swh db --help) in the section named after the MODULE argument.

Example:


$ cat conf.yml
storage:
  cls: postgresql
  db: postgresql://user:passwd@pghost:5433/swh-storage
  objstorage:
    cls: memory


$ swh db -C conf.yml init storage  # or
$ SWH_CONFIG_FILENAME=conf.yml swh db init storage
$ # or
$ swh db init --dbname postgresql://user:passwd@pghost:5433/swh-storage storage
swh db-init [OPTIONS] MODULE

Options

-d, --dbname, --db-name <dbname>#

Database name or connection URI.

--flavor <flavor>#

Database flavor.

Arguments

MODULE#

Required argument