Usually, we have a few basic shell commands that are dependent on the repository.
It can be running lint or tests, etc.
> swiftlint ...
> xcodebuild test ...Additionally, these can be used within a monorepo by different teams, each with their own set of commands.
I have not found an existing tool that meets my needs for this task, so I have decided to create my own.
* The task format should be as compact and simple as possible;
* It is just a tool for creating shortcuts, not for implementing them.
All scripts should be stored in separate files, and then called from this tool using specific arguments;
* It should be possible to manually call without this tool if necessary.
+ Describes all tasks in a single file or separate files for each team;
+ Collects tasks from the root directory / to the current one;
+ A simple file format based on YAML, which does not support any specific programming language;
+ Supports calling one task from another at any time;
+ Prints a list of all tasks in a tree format.
curl -Ls http://swiftyfinch.github.io/geo/install.sh | bashIf you don't need to split tasks into separate files for each team, you can just create a single .geo.yml file in your repository:
.
β°β .geo.yml # Single file without namespacesOtherwise, create a folder called .geo and place *.yml files for each team in it:
.
β°β .geo # Folder
ββ taiga.yml # Namespace for 'taiga' team
β°β saiga.yml # Namespace for 'saiga' teamDescribe your commands in the following format:
# Description must be here
task_name: [String] or StringFor example:
# Lints *.swift files.
lint: swiftlint --strict --quiet
# Formats *.swift files.
format: swiftformat . --lint --quiet
# Lints & formats *.swift files.
tidy: [geo lint, geo format]
# Builds and prepares binary for release.
release:
- geo format # Call as dependency in the same geo process
- geo lint # Call as dependency in the same geo process
- mkdir -p Release
- swift package clean
- swift build -c release --arch arm64
- cp -f `swift build -c release --arch arm64 --show-bin-path`/geo Release/geo
- strip -rSTx Release/geo
- cd Release && zip -r arm64.zip geoNote
You can call another task like geo lint anywhere.
It will be called within the same geo process, not separately.
Then you can get a list of your commands:
> geo
ββ format # Formats *.swift files.
ββ lint # Lints *.swift files.
ββ release # Builds and prepares binary for release.
β°β tidy # Lints & formats *.swift files.And finally, you can run the described commands:
> geo lint
[1/1] swiftlint --strict --quiet
> geo format
[1/1] swiftformat . --lint --quiet
> geo tidy
[1/2] swiftlint --strict --quiet
[2/2] swiftformat . --lint --quiet
> geo release
[1/8] swiftformat . --lint --quiet
[2/8] swiftlint --strict --quiet
[3/8] mkdir -p Release
[4/8] swift package clean
[5/8] swift build -c release --arch arm64
[6/8] cp -f `swift build -c release --arch arm64 --show-bin-path`/geo Release/geo
[7/8] strip -rSTx Release/geo
[8/8] cd Release && zip -r arm64.zip geoYou can add commands to different directories and have them all run recursively.
It can be useful if you want to include some secret commands in your shared list:
/
ββ .geo.yml # General
β°β Folder0
ββ .geo.yml # More specific
β°β Folder1
ββ .geo.yml # More specific
β°β .
β°β .geo.yml # More specificFeel free to open a pull request or a discussion.
- Author of Fan Art: https://www.reddit.com/r/HollowKnight/comments/12imdep/geo/.