#!/usr/bin/env nu use ./cntfy.nu def main [ subcommand: string@subcommands ] { if $subcommand == "help" { print $"cntfy ", print "" print "Subcommands: " for subcommand in ( subcommands ) { print "" print $"(ansi {attr: b})($subcommand)(ansi reset)" print ( help $"main ($subcommand)" ) } } else { let span = (metadata $subcommand).span; error make { msg: $"Unknown subcommand ($subcommand)", label: { text: "Unknown subcommand", start: $span.start, end: $span.end } } } } def subcommands [] { ["publish"] } # Publishes a message with certain properties def `main publish` [ topic: string message: string --title: string --priority: number --tags: list --actions: list --icon: string ] { cntfy publish $topic $message --title $title --priority $priority --tags $tags --actions $actions --icon $icon }