From f4f04c31f5a47be823460caa7b4f57c1eb31414b Mon Sep 17 00:00:00 2001 From: Max-Joseph Krempl Date: Thu, 28 Mar 2024 01:03:22 +0100 Subject: [PATCH] Created package for new CLI tool "dreimetadaten" --- Makefile | 24 ++++++++++++++++++++++++ code/.gitignore | 6 ++++++ code/Package.swift | 22 ++++++++++++++++++++++ code/dreimetadaten/Command.swift | 18 ++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 Makefile create mode 100644 code/.gitignore create mode 100644 code/Package.swift create mode 100644 code/dreimetadaten/Command.swift diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..c7fa3d6d --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +DIR = bin +SWIFTBUILD = swift build --package-path code -c release --product +BINARIES = code/.build/release + +.PHONY: dreimetadaten all clean distclean +.DEFAULT_GOAL := all + + +$(DIR): + mkdir $(DIR) + +dreimetadaten: + $(SWIFTBUILD) dreimetadaten + + +all: $(DIR) dreimetadaten + @cp -v $(BINARIES)/dreimetadaten $(DIR)/ + +clean: + swift package clean --package-path code + rm -f $(DIR)/dreimetadaten + +distclean: clean + rm -f code/Package.resolved diff --git a/code/.gitignore b/code/.gitignore new file mode 100644 index 00000000..cafeef6d --- /dev/null +++ b/code/.gitignore @@ -0,0 +1,6 @@ +/.build + +.swiftpm +Package.resolved + +xcuserdata/ diff --git a/code/Package.swift b/code/Package.swift new file mode 100644 index 00000000..7aa198ad --- /dev/null +++ b/code/Package.swift @@ -0,0 +1,22 @@ +// swift-tools-version: 5.7 + +import PackageDescription + +let package = Package( + name: "dreimetadaten", + products: [ + .executable(name: "dreimetadaten", targets: ["dreimetadaten"]), + ], + dependencies: [ + .package(url: "https://github.com/YourMJK/CommandLineTool", from: "1.1.0"), + ], + targets: [ + .executableTarget( + name: "dreimetadaten", + dependencies: [ + "CommandLineTool", + ], + path: "dreimetadaten" + ) + ] +) diff --git a/code/dreimetadaten/Command.swift b/code/dreimetadaten/Command.swift new file mode 100644 index 00000000..2ea6715e --- /dev/null +++ b/code/dreimetadaten/Command.swift @@ -0,0 +1,18 @@ +// +// Command.swift +// dreimetadaten +// +// Created by YourMJK on 26.03.24. +// + +import Foundation +import CommandLineTool +import ArgumentParser + +@main +struct Command: ParsableCommand { + static let configuration = CommandConfiguration( + commandName: executableName, + version: "1.0.0" + ) +}