#!/usr/bin/env bash
# shellcheck disable=SC2317

# Simple op: one string param, returns an object with a string field.

@operation.git.sign() {
    @in.string key
    @out.string signature
    @note "Requires GPG key on the local machine"

    @do() {
        local key
        local sig

        key=$(@in key)
        sig="PGP-SIGNED-BY-${key}-$(date +%s)"

        @out.string signature "$sig"
        @return.out
    }

    @undo() {
        @return "$(@string "reset HEAD~1")"
    }

    @is-done() {
        return 1
    }
}
