Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
grabit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
creations
grabit
Compare revisions
270d531d6ebdca278924ac2df61dae4fcdd314e2 to 8378f5b1d6d2e1ced0ace91e5047887d191e4997
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
creations/grabit
Select target project
No results found
8378f5b1d6d2e1ced0ace91e5047887d191e4997
Select Git revision
Loading items
Swap
Target
creations/grabit
Select target project
creations/grabit
1 result
270d531d6ebdca278924ac2df61dae4fcdd314e2
Select Git revision
Loading items
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source
0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
helpers/config.sh
+1
-12
1 addition, 12 deletions
helpers/config.sh
helpers/variables.sh
+1
-3
1 addition, 3 deletions
helpers/variables.sh
main.sh
+1
-14
1 addition, 14 deletions
main.sh
with
3 additions
and
29 deletions
helpers/config.sh
View file @
8378f5b1
...
...
@@ -200,7 +200,6 @@ setup_config() {
local
show_notifications
local
save_images
local
default_option
local
snip_sound
echo
-ne
"
${
CYAN
}
What do you want the default option to be? (upload/save/copy):
${
RESET
}
"
read
default_option
...
...
@@ -245,16 +244,6 @@ setup_config() {
[[
"
$show_notifications
"
=
~ ^
(
y|Y
)
$
]]
&&
show_notifications
=
"true"
||
show_notifications
=
"false"
set_value
"SHOW_NOTIFICATIONS"
"
$show_notifications
"
echo
-ne
"
${
CYAN
}
Do you want to play a sound after upload? (y/n):
${
RESET
}
"
read
snip_sound
while
!
[[
"
$snip_sound
"
=
~ ^
(
y|Y|n|N|true|false
)
$
]]
;
do
echo
-e
"
${
RED
}
Invalid option. Please enter 'y' or 'n'.
${
RESET
}
"
echo
-ne
"
${
CYAN
}
Do you want to play a sound after upload? (y/n):
${
RESET
}
"
read
snip_sound
done
[[
"
$snip_sound
"
=
~ ^
(
y|Y
)
$
]]
&&
snip_sound
=
"true"
||
snip_sound
=
"false"
set_value
"SNIP_SOUND"
"
$snip_sound
"
echo
-ne
"
${
CYAN
}
Do you want to show capture preview? (y/n):
${
RESET
}
"
read
show_capture_preview
while
!
[[
"
$show_capture_preview
"
=
~ ^
(
y|Y|n|N|true|false
)
$
]]
;
do
...
...
This diff is collapsed.
Click to expand it.
helpers/variables.sh
View file @
8378f5b1
...
...
@@ -13,7 +13,6 @@ declare -A ALLOWED_KEYS=(
[
"log_level"
]=
"^(DEBUG|INFO|WARN|ERROR)$"
[
"SHOW_CAPTURE_PREVIEW"
]=
"^(true|false)$"
[
"SHOW_NOTIFICATIONS"
]=
"^(true|false)$"
[
"SNIP_SOUND"
]=
"^(true|false)$"
[
"SAVE_IMAGES"
]=
"^(true|false)$"
[
"SAVE_DIR"
]=
"^.+$"
[
"DOMAIN"
]=
"^.+$"
...
...
@@ -30,7 +29,6 @@ declare -A ALLOWED_KEYS=(
REQUIRED_KEYS
=(
"SHOW_CAPTURE_PREVIEW"
"SHOW_NOTIFICATIONS"
"SNIP_SOUND"
"SAVE_IMAGES"
"DEFAULT_OPTION"
)
...
...
This diff is collapsed.
Click to expand it.
main.sh
View file @
8378f5b1
...
...
@@ -65,7 +65,6 @@ while [[ $# -gt 0 ]]; do
--silent
)
SHOW_NOTIFICATIONS
=
false
SHOW_CAPTURE_PREVIEW
=
false
SNIP_SOUND
=
false
shift
;;
--
*
)
...
...
@@ -94,9 +93,6 @@ SHOULD_UPLOAD=$(get_value "DEFAULT_OPTION")
SHOW_NOTIFICATIONS
=
$(
get_value
"SHOW_NOTIFICATIONS"
)
[[
"
$SHOW_NOTIFICATIONS
"
==
"true"
]]
&&
SHOW_NOTIFICATIONS
=
true
||
SHOW_NOTIFICATIONS
=
false
SNIP_SOUND
=
$(
get_value
"SNIP_SOUND"
)
[[
"
$SNIP_SOUND
"
==
"true"
]]
&&
SNIP_SOUND
=
true
||
SNIP_SOUND
=
false
SHOW_CAPTURE_PREVIEW
=
$(
get_value
"SHOW_CAPTURE_PREVIEW"
)
[[
"
$SHOW_CAPTURE_PREVIEW
"
==
"true"
]]
&&
SHOW_CAPTURE_PREVIEW
=
true
||
SHOW_CAPTURE_PREVIEW
=
false
...
...
@@ -155,12 +151,6 @@ send_notification() {
"
${
notify_cmd
[@]
}
"
}
play_sound
()
{
[[
"
$SNIP_SOUND
"
==
"false"
]]
&&
return
paplay /usr/share/sounds/freedesktop/stereo/camera-shutter.oga
}
SHOULD_UPLOAD
=
false
SHOULD_SAVE
=
"
$(
get_value
"SAVE_IMAGES"
)
"
SHOULD_COPY
=
false
...
...
@@ -375,17 +365,14 @@ MIME_TYPE=$(file --mime-type -b "$FILE")
if
[[
"
$MIME_TYPE
"
==
image/
*
]]
;
then
if
[[
"
$SHOW_NOTIFICATIONS
"
==
"true"
]]
;
then
send_notification
"Uploaded to
$SERVICE
"
"
$FILE_URL
"
"
$FILE
"
play_sound
fi
if
[[
"
$SHOW_CAPTURE_PREVIEW
"
==
"true"
]]
;
then
"
$PYTHON_EXEC
"
"
$SCRIPT_DIR
/helpers/show_image.py"
"
$FILE
"
"Uploaded to
$SERVICE
"
play_sound
fi
else
if
[[
"
$SHOW_NOTIFICATIONS
"
==
"true"
]]
;
then
send_notification
"Uploaded to
$SERVICE
"
"
$FILE_URL
"
play_sound
fi
fi
...
...
This diff is collapsed.
Click to expand it.