All New

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Register

Login

All New Register Login

All gists

Recently created
Least recently created
Recently updated
Least recently updated

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function flag::parse() {
2 local ctx="${_CURRENT_COMMAND:-__global__}"
3
4 # Reset runtime
5 _FLAG_VALUES=(); _FLAG_ARRAYS=(); _FLAG_SET=(); _FLAG_ARGS=()
6
7 # Check for --help/-h first (fast path)
8 local arg
9 for arg in "$@"; do
10 if [[ "$arg" == "--help" || "$arg" == "-h" ]]; then

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 root@wireguard:/etc/wireguard/wgctl# _CURRENT_LOADING_CMD="peer"
2 _CURRENT_COMMAND="peer"
3 root@wireguard:/etc/wireguard/wgctl# source /etc/wireguard/wgctl/commands/peer/peer.sh
4 bash: hook::on: command not found
5 root@wireguard:/etc/wireguard/wgctl# source /etc/wireguard/wgctl/core/framework/hook.sh
6 root@wireguard:/etc/wireguard/wgctl# source /etc/wireguard/wgctl/commands/peer/peer.sh
7 root@wireguard:/etc/wireguard/wgctl# cmd::peer::on_load
8 bash: command::define: command not found
9 bash: command::define: command not found
10 root@wireguard:/etc/wireguard/wgctl# source /etc/wireguard/wgctl/core/framework/command.sh

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::peer::update_tunnel() {
2 local name="" type="" all=false mode="" force=false
3
4 while [[ $# -gt 0 ]]; do
5 case "$1" in
6 --name) name="$2"; shift 2 ;;
7 --type) type="$2"; shift 2 ;;
8 --all) all=true; shift ;;
9 --mode) mode="$2"; shift 2 ;;
10 --force) force=true; shift ;;

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::peer::run() {
2 local subcmd="${1:-help}"
3 shift || true
4 case "$subcmd" in
5 update-dns) cmd::peer::update_dns "$@" ;;
6 update-tunnel) cmd::peer::update_tunnel "$@" ;;
7 help) cmd::peer::help ;;
8 *)
9 log::error "Unknown subcommand: '${subcmd}'"
10 cmd::peer::help

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::config::run() {
2 local subcmd="${1:-show}"
3
4 # If first arg is a flag, treat as 'show' subcommand
5 if [[ "$subcmd" == --* ]]; then
6 subcmd="show"
7 else
8 shift || true
9 fi

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 /etc/wireguard/wgctl/commands/peer.command.sh:8:function cmd::peer::on_load() {
2 /etc/wireguard/wgctl/commands/peer.command.sh:22:function cmd::peer::help() {
3 /etc/wireguard/wgctl/commands/peer.command.sh:60:function cmd::peer::run() {
4 /etc/wireguard/wgctl/commands/peer.command.sh:79:function cmd::peer::update_dns() {
5 /etc/wireguard/wgctl/commands/peer.command.sh:143:function cmd::peer::update_tunnel() {
6 /etc/wireguard/wgctl/commands/group.command.sh:7:function cmd::group::on_load() {
7 /etc/wireguard/wgctl/commands/group.command.sh:25:function cmd::group::help() {
8 /etc/wireguard/wgctl/commands/group.command.sh:83:function cmd::group::run() {
9 /etc/wireguard/wgctl/commands/group.command.sh:121:function cmd::group::list() {
10 /etc/wireguard/wgctl/commands/group.command.sh:167:function cmd::group::show() {

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 root@wireguard:/etc/wireguard/wgctl# wc -l /etc/wireguard/wgctl/commands/logs.command.sh
2 sed -n '1,50p' /etc/wireguard/wgctl/commands/logs.command.sh
3 629 /etc/wireguard/wgctl/commands/logs.command.sh
4 #!/usr/bin/env bash
5
6 FW_EVENTS_LOG="$(ctx::fw_events_log)"
7 WG_EVENTS_LOG="$(ctx::events_log)"
8
9 function cmd::logs::on_load() {
10 flag::register --name

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 _APP_CORE_DIR="$(dirname "${BASH_SOURCE[0]}")"
4
5 # ============================================
6 # Core Bootstrap
7 # ============================================
8
9 source "${_APP_CORE_DIR}/context.sh"
10 source "${_APP_CORE_DIR}/json.sh"

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2 # core/framework/core.sh
3
4 _FRAMEWORK_DIR="$(dirname "${BASH_SOURCE[0]}")"
5
6 source "${_FRAMEWORK_DIR}/context.sh"
7 source "${_FRAMEWORK_DIR}/module.sh"
8 source "${_FRAMEWORK_DIR}/command.sh"
9 source "${_FRAMEWORK_DIR}/command_mixins.sh"
10 source "${_FRAMEWORK_DIR}/flag.sh"

nuno / core.sh

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 # ============================================
4 # Core Bootstrap
5 # ============================================
6
7 WGCTL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8 APP_DIR="$WGCTL_DIR"
9 FRAMEWORK_DIR="$APP_DIR/framework"
10 APP_CORE_DIR="$APP_DIR/app"
Newer Older

Powered by Opengist ⋅ Load: 144ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文
⋅ KrilHub