diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 0cd25fa..145e539 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -31,16 +31,48 @@ builds: dir: ./cmd/ goos: - linux - - windows - darwin goarch: - amd64 main: . binary: scicat-cli + - id: "scicat-cli-win" + flags: + - -trimpath + ldflags: + - "-s -w -X 'github.com/paulscherrerinstitute/scicat/cmd/commands.VERSION={{.Version}}'" + env: + - CGO_ENABLED=0 + dir: ./cmd/ + goos: + - windows + goarch: + - amd64 + main: . + binary: scicat-cli archives: - - format: tar.gz + - id: scicat-cli + format: tar.gz + builds: + - scicat-cli + wrap_in_directory: true + name_template: >- + {{ .ProjectName }}_ + {{- .Version }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + files: + - src: cmd/scripts/* + strip_parent: true + - id: scicat-cli-win + format: zip + builds: + - scicat-cli-win wrap_in_directory: true name_template: >- {{ .ProjectName }}_ @@ -50,10 +82,6 @@ archives: {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} - # use zip for windows archives - format_overrides: - - goos: windows - format: zip changelog: sort: asc diff --git a/cmd/scripts/argconverter.sh b/cmd/scripts/argconverter.sh new file mode 100644 index 0000000..e5efac9 --- /dev/null +++ b/cmd/scripts/argconverter.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +function arg_conversion { + args=("$@") + + # Initialize an empty array to hold the modified arguments + modified_args=() + + for arg in "${args[@]}" + do + # Check if the argument starts with a single hyphen and is not a double hyphen + if [[ $arg == -[!-]* ]]; then + # Modify the argument to start with a double hyphen + modified_args+=(--"${arg:1}") + else + # Add the argument as is + modified_args+=("$arg") + fi + done + + echo "${modified_args[@]}" +} diff --git a/cmd/scripts/datasetArchiver b/cmd/scripts/datasetArchiver new file mode 100755 index 0000000..a7d6c99 --- /dev/null +++ b/cmd/scripts/datasetArchiver @@ -0,0 +1,11 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# shellcheck source=/dev/null +source "$SCRIPT_DIR"/argconverter.sh + +modified_args=$(arg_conversion "$@") + +# Call `echo` with the modified arguments +"$SCRIPT_DIR"/scicat-cli datasetArchiver "${modified_args[@]}" diff --git a/cmd/scripts/datasetCleaner b/cmd/scripts/datasetCleaner new file mode 100755 index 0000000..edffcbe --- /dev/null +++ b/cmd/scripts/datasetCleaner @@ -0,0 +1,11 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# shellcheck source=/dev/null +source "$SCRIPT_DIR"/argconverter.sh + +modified_args=$(arg_conversion "$@") + +# Call `echo` with the modified arguments +"$SCRIPT_DIR"/scicat-cli datasetCleaner "${modified_args[@]}" diff --git a/cmd/scripts/datasetGetProposal b/cmd/scripts/datasetGetProposal new file mode 100755 index 0000000..e09413c --- /dev/null +++ b/cmd/scripts/datasetGetProposal @@ -0,0 +1,11 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# shellcheck source=/dev/null +source "$SCRIPT_DIR"/argconverter.sh + +modified_args=$(arg_conversion "$@") + +# Call `echo` with the modified arguments +"$SCRIPT_DIR"/scicat-cli datasetGetProposal "${modified_args[@]}" diff --git a/cmd/scripts/datasetIngestor b/cmd/scripts/datasetIngestor new file mode 100755 index 0000000..f8b8425 --- /dev/null +++ b/cmd/scripts/datasetIngestor @@ -0,0 +1,11 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# shellcheck source=/dev/null +source "$SCRIPT_DIR"/argconverter.sh + +modified_args=$(arg_conversion "$@") + +# Call `echo` with the modified arguments +"$SCRIPT_DIR"/scicat-cli datasetIngestor "${modified_args[@]}" diff --git a/cmd/scripts/datasetPublishData b/cmd/scripts/datasetPublishData new file mode 100644 index 0000000..22c289d --- /dev/null +++ b/cmd/scripts/datasetPublishData @@ -0,0 +1,11 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# shellcheck source=/dev/null +source "$SCRIPT_DIR"/argconverter.sh + +modified_args=$(arg_conversion "$@") + +# Call `echo` with the modified arguments +"$SCRIPT_DIR"/scicat-cli datasetPublishData "${modified_args[@]}" diff --git a/cmd/scripts/datasetPublishDataRetrieve b/cmd/scripts/datasetPublishDataRetrieve new file mode 100644 index 0000000..313c5d6 --- /dev/null +++ b/cmd/scripts/datasetPublishDataRetrieve @@ -0,0 +1,11 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# shellcheck source=/dev/null +source "$SCRIPT_DIR"/argconverter.sh + +modified_args=$(arg_conversion "$@") + +# Call `echo` with the modified arguments +"$SCRIPT_DIR"/scicat-cli datasetPublishDataRetrieve "${modified_args[@]}" diff --git a/cmd/scripts/datasetRetriever b/cmd/scripts/datasetRetriever new file mode 100755 index 0000000..572c7b8 --- /dev/null +++ b/cmd/scripts/datasetRetriever @@ -0,0 +1,11 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# shellcheck source=/dev/null +source "$SCRIPT_DIR"/argconverter.sh + +modified_args=$(arg_conversion "$@") + +# Call `echo` with the modified arguments +"$SCRIPT_DIR"/scicat-cli datasetRetriever "${modified_args[@]}" diff --git a/cmd/scripts/waitForJobFinished b/cmd/scripts/waitForJobFinished new file mode 100755 index 0000000..2155b5f --- /dev/null +++ b/cmd/scripts/waitForJobFinished @@ -0,0 +1,11 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# shellcheck source=/dev/null +source "$SCRIPT_DIR"/argconverter.sh + +modified_args=$(arg_conversion "$@") + +# Call `echo` with the modified arguments +"$SCRIPT_DIR"/scicat-cli waitForJobFinished "${modified_args[@]}"