-
Notifications
You must be signed in to change notification settings - Fork 50
/
paths.d-helper
executable file
·111 lines (93 loc) · 4.22 KB
/
paths.d-helper
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env sh
# This file is part of shellfire. It is subject to the licence terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/shellfire-dev/shellfire/master/COPYRIGHT. No part of shellfire, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
# Copyright © 2014-2015 The developers of shellfire. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/shellfire-dev/shellfire/master/COPYRIGHT.
_program()
{
core_usesIn pathsd_helper validate execute
core_usesIn pathsd_helper/actions Debian CentOS
pathsd_helper_entrypoint()
{
pathsd_helper_execute_makePathsAbsolute
pathsd_helper_execute_setDependencyPath
pathsd_helper_execute_guardDependencyPath
pathsd_helper_execute_setExtractFunction
pathsd_helper_execute_actions Debian CentOS
}
}
_program_name='paths.d-helper'
_program_namespace='pathsd_helper'
_program_version='unversioned'
_program_package_or_build=''
_program_path="$([ "${_program_fattening_program_path+set}" = 'set' ] && printf '%s\n' "$_program_fattening_program_path" || ([ "${0%/*}" = "${0}" ] && printf '%s\n' '.' || printf '%s\n' "${0%/*}"))"
_program_libPath="${_program_path}/lib"
_program_etcPath="${_program_path}/etc"
_program_entrypoint='pathsd_helper_entrypoint'
_program_commandLine_parseInitialise()
{
pathsd_helper_dependencyCheck_default='Homebrew'
pathsd_helper_pathsdPath_default="$(pwd)"
}
_program_commandLine_helpMessage()
{
_program_commandLine_helpMessage_usage="[OPTION]..."
_program_commandLine_helpMessage_description="Produces a list of packages for a dependency check in paths.d"
_program_commandLine_helpMessage_options="
-d, --dependency-check DEP Dependency check DEP, eg Debian.
Defaults to '$pathsd_helper_dependencyCheck_default'.
-p, --pathsd-path PATH PATH parenting 'etc/$core_libraryName/paths.d'
Defaults to current working directory:-
$pathsd_helper_pathsdPath_default"
_program_commandLine_helpMessage_optionsSpacing=' '
_program_commandLine_helpMessage_configurationKeys="
pathsd_helper_dependencyCheck Equivalent to --dependency-check
pathsd_helper_pathsdPath Equivalent to --pathsd-path
"
_program_commandLine_helpMessage_examples="
${_program_name} -d Debian
"
}
_program_commandLine_optionExists()
{
case "$optionName" in
d|dependency-check)
echo 'yes-argumented'
;;
p|pathsd-path)
echo 'yes-argumented'
;;
*)
echo 'no'
;;
esac
}
_program_commandLine_processOptionWithArgument()
{
case "$optionName" in
d|dependency-check)
pathsd_helper_validate_dependencyCheck $core_commandLine_exitCode_USAGE 'option' "$optionNameIncludingHyphens" "$optionValue"
pathsd_helper_dependencyCheck="$optionValue"
;;
p|pathsd-path)
pathsd_helper_validate_pathsdPath $core_commandLine_exitCode_USAGE 'option' "$optionNameIncludingHyphens" "$optionValue"
pathsd_helper_pathsdPath="$optionValue"
;;
esac
}
_program_commandLine_validate()
{
if core_variable_isSet pathsd_helper_dependencyCheck; then
pathsd_helper_validate_dependencyCheck $core_commandLine_exitCode_CONFIG 'configuration setting' 'pathsd_helper_dependencyCheck' "$pathsd_helper_dependencyCheck"
else
core_message INFO "Defaulting --dependency-check to '$pathsd_helper_dependencyCheck_default'"
pathsd_helper_dependencyCheck="$pathsd_helper_dependencyCheck_default"
pathsd_helper_validate_dependencyCheck $core_commandLine_exitCode_CONFIG 'default' 'pathsd_helper_dependencyCheck' "$pathsd_helper_dependencyCheck"
fi
if core_variable_isSet pathsd_helper_pathsdPath; then
pathsd_helper_validate_pathsdPath $core_commandLine_exitCode_CONFIG 'configuration setting' 'pathsd_helper_pathsdPath' "$pathsd_helper_pathsdPath"
else
core_message INFO "Defaulting --paths-path to '$pathsd_helper_pathsdPath_default'"
pathsd_helper_pathsdPath="$pathsd_helper_pathsdPath_default"
pathsd_helper_validate_pathsdPath $core_commandLine_exitCode_CONFIG 'default' 'pathsd_helper_pathsdPath' "$pathsd_helper_pathsdPath"
fi
}
. "$_program_libPath"/shellfire/core/init.functions "$@"