add some helpful messages to curl command

This commit is contained in:
Franek 2024-05-08 20:56:00 +02:00
parent ae81d8467c
commit e79cd00a06
No known key found for this signature in database
GPG Key ID: 0329F871B2079351
2 changed files with 4 additions and 3 deletions

View File

@ -129,7 +129,7 @@ const COMMANDS = [
name: 'curl', name: 'curl',
description: 'open website in new tab', description: 'open website in new tab',
usage: '<website>', usage: '<website>',
usage_examples: ['curl google.com'], usage_examples: ['curl https://google.com'],
arguments: [ arguments: [
{ {
name: 'url', name: 'url',
@ -138,7 +138,7 @@ const COMMANDS = [
multiword: true, multiword: true,
check: (url) => URL_REGEX.test(url) check: (url) => URL_REGEX.test(url)
? null ? null
: "invalid URL" : "invalid URL or missing protocol"
} }
], ],
output: (url) => { output: (url) => {

View File

@ -1,4 +1,5 @@
const URL_REGEX = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/; const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g;
const LINKS = { const LINKS = {
'gitea': 'https://git.sador.me/sadorowo', 'gitea': 'https://git.sador.me/sadorowo',
'instagram': 'https://instagram.com/sadorowo', 'instagram': 'https://instagram.com/sadorowo',