-
Notifications
You must be signed in to change notification settings - Fork 1
/
check-name.bash
53 lines (44 loc) · 1.13 KB
/
check-name.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Copyright (c) 2023 Michael Federczuk
# SPDX-License-Identifier: MPL-2.0 AND Apache-2.0
if ! command -v trace_cmd > '/dev/null'; then
return
fi
function check-name() {
trace_cmd type -a "$1"
if command -v command_not_found_handle > '/dev/null'; then
printf '\n'
trace_cmd command_not_found_handle "$1"
fi
printf '\n'
if command -v dnf > '/dev/null'; then
trace_cmd dnf search "$1"
else
printf 'dnf is not installed; cannot search for dnf package\n'
fi
printf '\n'
if command -v apt > '/dev/null'; then
trace_cmd apt list "$1"
printf '\n'
trace_cmd apt list "*$1*"
else
printf 'apt is not installed; cannot search for apt package\n'
fi
printf '\n'
if command -v flatpak > '/dev/null'; then
trace_cmd flatpak search "$1"
else
printf 'flatpak is not installed; cannot search for flatpak package\n'
fi
printf '\n'
if command -v snap > '/dev/null'; then
trace_cmd snap find "$1"
else
printf 'snapd is not installed; cannot search for snap package\n'
fi
printf '\n'
if command -v npm > '/dev/null'; then
trace_cmd npm search "$1"
else
printf 'npm is not installed; cannot search for npm package\n'
fi
}