mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
feat: makefile
This commit is contained in:
parent
158641c921
commit
0629ad9ab6
2 changed files with 99 additions and 0 deletions
43
Makefile
Normal file
43
Makefile
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Variables
|
||||
UPSTREAM_REPO := upstream
|
||||
UPSTREAM_URL := https://github.com/gchq/CyberChef.git
|
||||
FORK_REPO := origin
|
||||
DEFAULT_BRANCH := main
|
||||
|
||||
# Default target if no target is specified
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
# Help command
|
||||
help:
|
||||
@echo "Usage:"
|
||||
@echo " make pr PR_ID=<PR_ID> - Fetch and push a PR from the upstream repo"
|
||||
@echo " make setup-upstream - Set up upstream repo (idempotent)"
|
||||
@echo " make clean PR_ID=<PR_ID> - Clean up the local PR branch"
|
||||
|
||||
# Setup upstream repo (idempotent)
|
||||
setup-upstream:
|
||||
@echo "Checking if upstream repo exists..."
|
||||
@if ! git remote get-url $(UPSTREAM_REPO) >/dev/null 2>&1; then \
|
||||
echo "Upstream repo not found. Adding upstream..."; \
|
||||
git remote add $(UPSTREAM_REPO) $(UPSTREAM_URL); \
|
||||
else \
|
||||
echo "Upstream repo already exists."; \
|
||||
fi
|
||||
|
||||
# Fetch the PR from upstream, create a branch, and push it to your fork
|
||||
pr: setup-upstream
|
||||
@if [ -z "$(PR_ID)" ]; then \
|
||||
echo "Error: PR_ID is not set. Usage: make pr PR_ID=<PR_ID>"; \
|
||||
exit 1; \
|
||||
fi
|
||||
git fetch $(UPSTREAM_REPO) pull/$(PR_ID)/head:pr-$(PR_ID)
|
||||
git checkout pr-$(PR_ID)
|
||||
git push $(FORK_REPO) pr-$(PR_ID)
|
||||
|
||||
# Clean up the local PR branch
|
||||
clean:
|
||||
@if [ -z "$(PR_ID)" ]; then \
|
||||
echo "Error: PR_ID is not set. Usage: make clean PR_ID=<PR_ID>"; \
|
||||
exit 1; \
|
||||
fi
|
||||
git branch -d pr-$(PR_ID)
|
56
src/core/operations/ZStandardDecode.mjs
Normal file
56
src/core/operations/ZStandardDecode.mjs
Normal file
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* @author Scarjit [ferdinand@linnenberg.dev]
|
||||
* @copyright Crown Copyright 2024
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
|
||||
/**
|
||||
* ZStandard Decode operation
|
||||
*/
|
||||
class ZStandardDecode extends Operation {
|
||||
|
||||
/**
|
||||
* ZStandardDecode constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "ZStandard Decode";
|
||||
this.module = "Compression";
|
||||
this.description = "Zstandard is a lossless data compression algorithm designed for fast compression and decompression. It was developed by Facebook.";
|
||||
this.infoURL = "https://wikipedia.org/wiki/Zstd"; // Usually a Wikipedia link. Remember to remove localisation (i.e. https://wikipedia.org/etc rather than https://en.wikipedia.org/etc)
|
||||
this.inputType = "ArrayBuffer";
|
||||
this.outputType = "ArrayBuffer";
|
||||
this.args = [
|
||||
/* Example arguments. See the project wiki for full details.
|
||||
{
|
||||
name: "First arg",
|
||||
type: "string",
|
||||
value: "Don't Panic"
|
||||
},
|
||||
{
|
||||
name: "Second arg",
|
||||
type: "number",
|
||||
value: 42
|
||||
}
|
||||
*/
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {ArrayBuffer} input
|
||||
* @param {Object[]} args
|
||||
* @returns {ArrayBuffer}
|
||||
*/
|
||||
run(input, args) {
|
||||
// const [firstArg, secondArg] = args;
|
||||
|
||||
throw new OperationError("Test");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default ZStandardDecode;
|
Loading…
Add table
Add a link
Reference in a new issue