cmd

package
v1.0.54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddDatasetsCmd = &cobra.Command{
	Use:   "add",
	Short: "Add datasets",
	Long: `
	Add one or more datasets from a JSONL (JSON Lines) formatted file via stdin.
	Each line represents a single dataset.

	Outputs either a success message with the dataset ID or an error message.
	Each message contains the number pointing to the corresponding line in the input file:

		$ ./biblio-backoffice dataset add < file.jsonl
		stored and indexed dataset [ID] at line [LINENO]
		failed to validate dataset [ID] at line [LINENO]: [MSG]
	`,
	RunE: AddDatasets,
}
View Source
var AddFileCmd = &cobra.Command{
	Use:   "add [file]",
	Short: "Add file by path",
	Long: `
	Add a single file to the filestore.
	File provided is the file that will be added to the filestore.

	Prints id and local path to stdout:

		<id> <path>

	The id is the sha256 checksum of the file. You can use it to check if a
	file was succesfully added to the filestore:

		$ ./biblio-backoffice file add /path/to/file.txt > /path/to/id.txt
		$ sha256sum -c /path/to/id.txt
	`,
	Args: cobra.ExactArgs(1),
	RunE: AddFile,
}
View Source
var AddManyFileCmd = &cobra.Command{
	Use:   "add-many [file]",
	Short: "Add multiple files",
	Long: `
	Add many files to the filestore.
	Expected is txt file containing a file path per line.
	Reads from the stdin when file is not provided.
	For each path the new id followed by the old path is printed to the stdout:

		<id> <path>

	Can easily be checked as following:

		$ ./biblio-backoffice file add_many < /path/to/file_paths.txt > /path/to/ids.txt
		$ sha256sum -c /path/to/ids.txt
	`,
	RunE: AddManyFile,
}
View Source
var AddPublicationsCmd = &cobra.Command{
	Use:   "add",
	Short: "Add publications",
	Long: `
	Add one or more publications from a JSONL (JSON Lines) formatted file via stdin.
	Each line represents a single publication.

	Outputs either a success message with the publication ID or an error message.
	Each message contains the number pointing to the corresponding line in the input file:

		$ ./biblio-backoffice publication add < file.jsonl
		stored and indexed publication [ID] at line [LINENO]
		failed to validate publication [ID] at line [LINENO]: [MSG]
	`,
	RunE: AddPublications,
}
View Source
var CleanupDatasetsCmd = &cobra.Command{
	Use:   "cleanup",
	Short: "Clean up inconsistencies across store datasets",
	RunE:  CleanupDatasets,
}
View Source
var CleanupPublicationsCmd = &cobra.Command{
	Use:   "cleanup",
	Short: "Clean up inconsistencies across store publications",
	RunE:  CleanupPublications,
}
View Source
var DatasetCmd = &cobra.Command{
	Use:   "dataset [command]",
	Short: "Dataset commands",
}
View Source
var FileCmd = &cobra.Command{
	Use:   "file [command]",
	Short: "File commands",
}
View Source
var GetAllDatasetsCmd = &cobra.Command{
	Use:   "get-all",
	Short: "Get all datasets",
	Long: `
	Retrieve all stored datasets as a stream of JSONL formatted records.
	The stream will be outputted to stdout.

		$ ./biblio-backoffice dataset get-all > datasets.jsonl
	`,
	RunE: GetAllDatasets,
}
View Source
var GetAllPublicationsCmd = &cobra.Command{
	Use:   "get-all",
	Short: "Get all publications",
	Long: `
	Retrieve all stored publications as a stream of JSONL formatted records.
	The stream will be outputted to stdout.

		$ ./biblio-backoffice publication get-all > publications.jsonl
	`,
	RunE: GetAllPublications,
}
View Source
var GetDatasetCmd = &cobra.Command{
	Use:   "get [id]",
	Short: "Get dataset by id",
	Long: `
	Retrieve the a single dataset as a JSONL formatted record.
	The record will be outputted to stdout.

		$ ./biblio-backoffice dataset get [ID] > dataset.jsonl
	`,
	Args: cobra.ExactArgs(1),
	RunE: GetDataset,
}
View Source
var GetDatasetHistoryCmd = &cobra.Command{
	Use:   "get-history [id]",
	Short: "Get dataset history",
	Long: `
	Retrieve the history of a single dataset as a stream of JSONL formatted records.
	The stream will be outputted to stdout.

		$ ./biblio-backoffice dataset get-history [ID] > history.jsonl
	`,
	Args: cobra.ExactArgs(1),
	RunE: GetDatasetHistory,
}
View Source
var GetFileCmd = &cobra.Command{
	Use:   "get [sha256]",
	Short: "Get file",
	Args:  cobra.ExactArgs(1),
	RunE:  GetFile,
}
View Source
var GetPublicationCmd = &cobra.Command{
	Use:   "get [id]",
	Short: "Get publication by id",
	Long: `
	Retrieve the a single publication as a JSONL formatted record.
	The record will be outputted to stdout.

		$ ./biblio-backoffice publication get [ID] > publication.jsonl
	`,
	Args: cobra.ExactArgs(1),
	RunE: GetPublication,
}
View Source
var GetPublicationHistoryCmd = &cobra.Command{
	Use:   "get-history [id]",
	Short: "Get publication history",
	Long: `
	Retrieve the history of a single publication as a stream of JSONL formatted records.
	The stream will be outputted to stdout.

		$ ./biblio-backoffice publication get-history [ID] > history.jsonl
	`,
	Args: cobra.ExactArgs(1),
	RunE: GetPublicationHistory,
}
View Source
var ImportDatasetsCmd = &cobra.Command{
	Use:   "import",
	Short: "Import datasets",
	Long: `
	Import one or more datasets from a JSONL (JSON Lines) formatted file via stdin.
	Each line represents a single dataset.

	Outputs either a success message with the dataset ID or an error message.
	Each message contains the number pointing to the corresponding line in the input file:

		$ ./biblio-backoffice dataset add < file.jsonl
		stored and indexed dataset [ID] at line [LINENO]
		failed to validate dataset [ID] at line [LINENO]: [MSG]
	`,
	RunE: ImportDatasets,
}
View Source
var ImportFileCmd = &cobra.Command{
	Use:   "import [file]",
	Short: "Import multiple files",
	Long: `
	Add many files to the filestore.
	Expected is json file containing "file" and "sha256":

		{ "file": "/path/to/file.txt", "sha256": "<sha256>" }

	Reads from the stdin when file is not provided.
	For each path the new id followed by the old path is printed to the stdout:
		<id> <path>

	Can easily be checked as following:
		$ ./biblio-backoffice file import < /path/to/file_paths.json > /path/to/ids.txt
		$ sha256sum -c /path/to/ids.txt

	If the filestore already contains an identical checksum, the import will be skipped.
	`,
	RunE: ImportFile,
}
View Source
var ImportPublicationsCmd = &cobra.Command{
	Use:   "import",
	Short: "Import publications",
	Long: `
	Import one or more datasets from a JSONL (JSON Lines) formatted file via stdin.
	Each line represents a single dataset.

	Outputs either a success message with the dataset ID or an error message.
	Each message contains the number pointing to the corresponding line in the input file:

		$ ./biblio-backoffice dataset add < file.jsonl
		stored and indexed dataset [ID] at line [LINENO]
		failed to validate dataset [ID] at line [LINENO]: [MSG]
	`,
	RunE: ImportPublications,
}
View Source
var MutateDatasetsCmd = &cobra.Command{
	Use:   "mutate",
	Short: "Mutate datasets",
	Long: `
	`,
	RunE: MutateDatasets,
}
View Source
var MutatePublicationsCmd = &cobra.Command{
	Use:   "mutate",
	Short: "Mutate publications",
	Long: `
	Add one or more mutations from a JSONL (JSON Lines) formatted file via stdin.
	Each line represents a single mutation.

	Outputs either a success message with the publication ID or an error message.
	Each message contains the number pointing to the corresponding line in the input file:

		$ ./biblio-backoffice publication mutate < file.jsonl
		mutated publication [ID] at line [LINENO]
		# or
		failed to mutate publication [ID] at line [LINENO]: [MSG]

	Example input file:

	    {"id":"1234", "op":"keyword.add", "args":["dna", "double helix"]}
	    {"id":"2345", "op":"classification.set", "args":["A3"]}

	`,
	RunE: MutatePublications,
}
View Source
var PublicationCmd = &cobra.Command{
	Use:   "publication [command]",
	Short: "Publication commands",
}
View Source
var PublicationRelateDatasetCmd = &cobra.Command{
	Use:   "relate-dataset [id] [dataset-id]",
	Short: "Add related dataset to publication",
	Long: `
	Relate a publication to a dataset.

	The "related_dataset" field will be filled on the publication side, the "related_publication"
	field will be filled on the dataset side.

	Outputs either a success message or an error message:

		$ ./biblio-backoffice relate-dataset [ID] [DATASET-ID]
		related: publication[id: ID] -> dataset[id: ID]
	`,
	Args: cobra.ExactArgs(2),
	RunE: PublicationRelateDataset,
}
View Source
var PurgeAllDatasetsCmd = &cobra.Command{
	Use:   "purge-all",
	Short: "Purge all datasets",
	RunE:  PurgeAllDatasets,
}
View Source
var PurgeAllPublicationsCmd = &cobra.Command{
	Use:   "purge-all",
	Short: "Purge all publications",
	RunE:  PurgeAllPublications,
}
View Source
var PurgeDatasetCmd = &cobra.Command{
	Use:   "purge [id]",
	Short: "Purge dataset",
	Long: `
	Purge a single stored dataset.

	Outputs either a success message with the dataset ID or an error message.

		$ ./biblio-backoffice dataset purge [ID]
		purged dataset [ID]
	`,
	Args: cobra.ExactArgs(1),
	RunE: PurgeDataset,
}
View Source
var PurgePublicationCmd = &cobra.Command{
	Use:   "purge [id]",
	Short: "Purge publication",
	Long: `
	Purge a single stored publication.

	Outputs either a success message with the dataset ID or an error message.

		$ ./biblio-backoffice publication purge [ID]
		purged publication [ID]
	`,
	Args: cobra.ExactArgs(1),
	RunE: PurgePublication,
}
View Source
var ReindexDatasetCmd = &cobra.Command{
	Use:   "reindex",
	Short: "Reindex all datasets",
	RunE:  ReindexDatasets,
}
View Source
var ReindexPublicationCmd = &cobra.Command{
	Use:   "reindex",
	Short: "Reindex all publications",
	RunE:  ReindexPublications,
}
View Source
var SearchDatasetsCmd = &cobra.Command{
	Use:   "search",
	Short: "Search datasets",
	RunE:  SearchDatasets,
}
View Source
var SearchPublicationsCmd = &cobra.Command{
	Use:   "search",
	Short: "Search publications",
	RunE:  SearchPublications,
}
View Source
var TransferPublicationsCmd = &cobra.Command{
	Use:   "transfer UID UID [PUBID]",
	Short: "Transfer publications between people",
	Long: `
	Transfer one or multiple publications between two persons.

	Each person id identified by an UUID. The first argument is the source, the second argument is the target person.
	Transferring a publication means replacing all matching instances of the source ID with the target's ID across all
	publicatoin fields (user, last_user & contributor fields).

	This operation transfers the current and all previous snapshots of a publication between persons.

	A publication ID can be passed as an optional third argument. If no publication ID is passed, the transfer will
	happen across all stored publications. If a publication ID is passed, the transfer command will be limited to that
	specific stored publication.

	The command outputs either a success message or an error message to stdout:

		$ ./biblio-client publication transfer UID UID
		p: ID: s: SNAPSHOT-ID ::: creator: UID -> UID
		p: ID: s: SNAPSHOT-ID ::: supervisor: UID -> UID
		p: ID: s: SNAPSHOT-ID ::: editor: UID -> UID

		$ ./biblio-client publication transfer UID UID
		Error: could not retrieve person UID: record not found

	If no matching instances of the source UID could be found, the transfer command won't produce any output.
	`,
	Args: cobra.RangeArgs(2, 3),
	RunE: TransferPublications,
}
View Source
var UpdateDatasetCmd = &cobra.Command{
	Use:   "update",
	Short: "Update dataset",
	Long: `
	Update one or multiple datasets.

	This command reads a JSONL formatted file from stdin and streams it to the store.

	It will output either a success message or an error message per record:

		$ ./biblio-backoffice dataset update < datasets.jsonl
	`,
	RunE: UpdateDataset,
}
View Source
var UpdatePublicationCmd = &cobra.Command{
	Use:   "update",
	Short: "Update publication",
	Long: `
	Update one or multiple publications.

	This command reads a JSONL formatted file from stdin and streams it to the store.

	It will output either a success message or an error message per record:

		$ ./biblio-backoffice publication update < publications.jsonl
	`,
	RunE: UpdatePublication,
}
View Source
var ValidateDatasetsCmd = &cobra.Command{
	Use:   "validate",
	Short: "Validate datasets",
	RunE:  ValidateDatasets,
}
View Source
var ValidatePublicationsCmd = &cobra.Command{
	Use:   "validate",
	Short: "Validate publications",
	RunE:  ValidatePublications,
}

Functions

func AddDatasets added in v1.0.22

func AddDatasets(cmd *cobra.Command, args []string) error

func AddFile added in v1.0.22

func AddFile(cmd *cobra.Command, args []string) error

func AddManyFile added in v1.0.25

func AddManyFile(cmd *cobra.Command, args []string) error

func AddPublications added in v1.0.22

func AddPublications(cmd *cobra.Command, args []string) error

func CleanupDatasets added in v1.0.28

func CleanupDatasets(cmd *cobra.Command, args []string) error

func CleanupPublications added in v1.0.23

func CleanupPublications(cmd *cobra.Command, args []string) error

func Execute added in v1.0.22

func Execute() error

func GetAllDatasets added in v1.0.22

func GetAllDatasets(cmd *cobra.Command, args []string) error

func GetAllPublications added in v1.0.22

func GetAllPublications(cmd *cobra.Command, args []string) error

func GetDataset added in v1.0.22

func GetDataset(cmd *cobra.Command, args []string) error

func GetDatasetHistory added in v1.0.22

func GetDatasetHistory(cmd *cobra.Command, args []string) error

func GetFile added in v1.0.22

func GetFile(cmd *cobra.Command, args []string) error

func GetPublication added in v1.0.22

func GetPublication(cmd *cobra.Command, args []string) error

func GetPublicationHistory added in v1.0.22

func GetPublicationHistory(cmd *cobra.Command, args []string) error

func ImportDatasets added in v1.0.22

func ImportDatasets(cmd *cobra.Command, args []string) error

func ImportFile added in v1.0.25

func ImportFile(cmd *cobra.Command, args []string) error

func ImportPublications added in v1.0.22

func ImportPublications(cmd *cobra.Command, args []string) error

func MutateDatasets added in v1.0.28

func MutateDatasets(cmd *cobra.Command, args []string) error

func MutatePublications added in v1.0.28

func MutatePublications(cmd *cobra.Command, args []string) error

func PublicationRelateDataset added in v1.0.22

func PublicationRelateDataset(cmd *cobra.Command, args []string) error

func PurgeAllDatasets added in v1.0.22

func PurgeAllDatasets(cmd *cobra.Command, args []string) error

func PurgeAllPublications added in v1.0.22

func PurgeAllPublications(cmd *cobra.Command, args []string) error

func PurgeDataset added in v1.0.22

func PurgeDataset(cmd *cobra.Command, args []string) error

func PurgePublication added in v1.0.22

func PurgePublication(cmd *cobra.Command, args []string) error

func ReindexDatasets added in v1.0.23

func ReindexDatasets(cmd *cobra.Command, args []string) error

func ReindexPublications added in v1.0.23

func ReindexPublications(cmd *cobra.Command, args []string) error

func SearchDatasets added in v1.0.22

func SearchDatasets(cmd *cobra.Command, args []string) error

func SearchPublications added in v1.0.22

func SearchPublications(cmd *cobra.Command, args []string) error

func TransferPublications added in v1.0.23

func TransferPublications(cmd *cobra.Command, args []string) error

func UpdateDataset added in v1.0.22

func UpdateDataset(cmd *cobra.Command, args []string) error

func UpdatePublication added in v1.0.22

func UpdatePublication(cmd *cobra.Command, args []string) error

func ValidateDatasets added in v1.0.22

func ValidateDatasets(cmd *cobra.Command, args []string) error

func ValidatePublications added in v1.0.22

func ValidatePublications(cmd *cobra.Command, args []string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL