aboutsummaryrefslogtreecommitdiff
path: root/docs/man/cleanpath.1
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunk@roden.local.stsci.edu>2021-05-04 17:34:38 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2021-05-04 21:14:16 -0400
commitea6e2613aca23c84373e686d739498969062f79e (patch)
treeba9cf39409056cad0b65a4ee953856230e73196b /docs/man/cleanpath.1
downloadcleanpath-ea6e2613aca23c84373e686d739498969062f79e.tar.gz
Initial commit
Diffstat (limited to 'docs/man/cleanpath.1')
-rw-r--r--docs/man/cleanpath.1116
1 files changed, 116 insertions, 0 deletions
diff --git a/docs/man/cleanpath.1 b/docs/man/cleanpath.1
new file mode 100644
index 0000000..84479c7
--- /dev/null
+++ b/docs/man/cleanpath.1
@@ -0,0 +1,116 @@
+.\" Automatically generated by Pandoc 2.13
+.\"
+.TH "CLEANPATH" "1" "" "" "Utility"
+.hy
+.SH NAME
+.PP
+\f[B]cleanpath\f[R] \[em] Filters unwanted elements from an environment
+variable
+.SH SYNOPSIS
+.PP
+\f[B]cleanpath\f[R] [options] [pattern \&...]
+.SH DESCRIPTION
+.PP
+\f[B]cleanpath\f[R] filters unwanted elements from an environment
+variable.
+By default, this utility reads from the \f[I]PATH\f[R] envrionment
+variable.
+This behavior may be overridden using the \f[B]--env\f[R] option
+described below.
+.SS OPTIONS
+.TP
+\f[B]-h\f[R], \f[B]--help\f[R]
+Prints brief usage information.
+.TP
+\f[B]-V\f[R], \f[B]--version\f[R]
+Prints the current version number.
+.TP
+\f[B]-e\f[R], \f[B]--exact\f[R]
+Filter when pattern is an exact match (default)
+.TP
+\f[B]-l\f[R], \f[B]--loose\f[R]
+Filter when any part of the pattern matches
+.TP
+\f[B]-r\f[R], \f[B]--regex\f[R]
+Filter matches with (Extended) Regular Expressions
+.TP
+\f[B]-s\f[R], \f[B]--sep\f[R] \f[I][str]\f[R]
+Use custom path separator (default: \f[I]`:'\f[R])
+.RS
+.PP
+The separator may be a string longer than one byte.
+.RE
+.TP
+\f[B]-E\f[R], \f[B]--env\f[R] \f[I][str]\f[R]
+Use custom environment variable (default: \f[I]PATH\f[R])
+.RS
+.PP
+The environment variable passed to \f[B]-E\f[R] must exist.
+.RE
+.SH EXAMPLES
+.SS A typical user PATH
+.PP
+/opt/special/bin:/usr/local/programX/bin:/usr/local/bin:/usr/bin:/bin
+.IP "1." 3
+Filter only \f[I]/usr/local/bin\f[R]
+.RS 4
+.PP
+cleanpath -e /usr/local/bin
+.PP
+/opt/special/bin:/usr/local/programX/bin:/usr/bin:/bin
+.RE
+.IP "2." 3
+Filter any paths containing \f[I]/usr/local\f[R]
+.RS 4
+.PP
+cleanpath -l /usr/local
+.PP
+/opt/special/bin:/usr/bin:/bin
+.RE
+.IP "3." 3
+Filter any paths containing \f[I]special\f[R] and \f[I]local\f[R]
+.RS 4
+.PP
+cleanpath -l special local
+.PP
+/usr/bin:/bin
+.RE
+.IP "4." 3
+Filter only \f[I]/usr/local/programX/bin\f[R] using regular expressions
+.RS 4
+.PP
+cleanpath -r `\[ha]/usr/local/p.*X/bin$'
+.PP
+/opt/special/bin:/usr/local/bin:/usr/bin:/bin
+.RE
+.SS Using different environment variables
+.IP "1." 3
+Filter a named environment variable with custom separator
+.RS 4
+.PP
+export TESTVAR=a:b/c:d/e:f
+.PP
+cleanpath -v TESTVAR -s / -l c
+.PP
+a:b/e:f
+.RE
+.SS Shell Scripting
+.PP
+PATH=\[lq]/usr/local/bin:/usr/bin:/bin\[rq]
+.PP
+PATH=\[lq]$(cleanpath -l /usr/local)\[rq]; export PATH
+.PP
+# /usr/local/bin has been filtered from PATH
+.SH ERRORS
+.PP
+\f[B]cleanpath\f[R] will exit non-zero (>0) when an error occurs.
+A value greater than one (1) indicates a fatal error.
+.SH BUGS
+.PP
+See GitHub Issues: <https://github.com/jhunkeler/cleanpath/issues>
+.SH AUTHOR
+.PP
+Joseph Hunkeler <jhunkeler\[at]gmail.com, jhunk\[at]stsci.edu>
+.SH SEE ALSO
+.PP
+\f[B]re_format(7)\f[R]