parseUrls done
This commit is contained in:
parent
b16a30f957
commit
cec4bb88c0
1 changed files with 16 additions and 0 deletions
|
@ -24,6 +24,20 @@ let
|
|||
# exec ${pkgs.appimage-run}/bin/appimage-run "$HOME/programs/Zettlr.AppImage"
|
||||
#'';
|
||||
|
||||
parseUrl = pkgs.writeBashBin "parseUrl" ''
|
||||
echo "$@" | \
|
||||
${pkgs.jq}/bin/jq --raw-input --raw-output '
|
||||
def parseURL: capture( "^((?<scheme>[^:/?#]+):)?(//(?<authority>(?<domain>[^/?#:]*)(:(?<port>[0-9]*))?))?((?<path>[^?#]*)\\?)?((?<query>([^#]*)))?(#(?<fragment>(.*)))?");
|
||||
parseURL
|
||||
'
|
||||
'';
|
||||
|
||||
parseAndCopyLink = pkgs.writeBashBin "parseAndCopyLink" ''
|
||||
${parseUrl}/bin/parseUrl "$@" | \
|
||||
${pkgs.jq}/bin/jq --raw-output '"\(.scheme)://\(.domain)\(.path)"' | \
|
||||
${pkgs.xclip}/bin/xclip
|
||||
'';
|
||||
|
||||
zettlr = unstablePkgs.zettlr;
|
||||
|
||||
replaceLinks = pkgs.writers.writeBashBin "replace-link-with-content" # sh
|
||||
|
@ -320,6 +334,8 @@ in {
|
|||
memo
|
||||
nixfmt
|
||||
dateutils
|
||||
parseUrl
|
||||
parseAndCopyLink
|
||||
|
||||
# needed for pycairo (in venv)
|
||||
pkgconf
|
||||
|
|
Loading…
Reference in a new issue