diff --git a/README.md b/README.md index 476b280..2722b1d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ is a simple file path library for Carp. ## Installation ```clojure -(load "https://veitheller.de/git/carpentry/path@0.0.3") +(load "git@git.veitheller.de:carpentry/path.git@0.0.4") ``` ### Usage @@ -16,7 +16,7 @@ has some functions to work with the `PATH` environment variable. It assumes either Windows or POSIX-style separators. -Look at [the documentation](https://veitheller.de/path) for more information. +Look at [the documentation](https://carpentry.dev/path) for more information.
- (Fn [a, b] String) -
-- (</> before after) --
-
joins before
and after
using the default path separator.
is a simple file path library for Carp.
+(load "git@git.veitheller.de:carpentry/path.git@0.0.4")
+
+The Path
module mostly operates on String
arguments. It allows you to
+split, join, and merge paths and extensions in a lot of different ways. It also
+has some functions to work with the PATH
environment variable.
It assumes either Windows or POSIX-style separators.
- -+ (Fn [a, b] String) +
++ (</> before after) ++
+
joins before
and after
using the default path separator.
- (Fn [(Ref String a)] Bool) -
-- (absolute? p) --
-
checks whether a path is absolute.
++ (Fn [(Ref String a)] (Maybe String)) +
++ (absolute p) ++
+
makes an absolute path from p
.
+ (Fn [(Ref String a)] Bool) +
++ (absolute? p) ++
+
checks whether a path is absolute.
As such, it is the inverse to relative?.
- -- (Fn [(Ref String a), (Ref String b)] String) -
-- (add-extension p ext) --
-
adds an extension ext
to a path p
.
+ (Fn [(Ref String a), (Ref String b)] String) +
++ (add-extension p ext) ++
+
adds an extension ext
to a path p
.
- (Fn [(Ref String a)] String) -
-- (basename p) --
-
gets the basename of the path p
.
+ (Fn [(Ref String a)] String) +
++ (basename p) ++
+
gets the basename of the path p
.
- (Fn [] (Maybe String)) -
-- (cwd) --
-
returns the current working directory as a Maybe
. The ways in
+
+ (Fn [] (Maybe String)) +
++ (cwd) ++
+
returns the current working directory as a Maybe
. The ways in
which it can fail are OS-dependent, but it should happen relatively rare.
- (Fn [(Ref String a)] String) -
-- (drop-extension p) --
-
drops the extension of a path p
. Does nothing if there
+
+ (Fn [(Ref String a)] String) +
++ (drop-extension p) ++
+
drops the extension of a path p
. Does nothing if there
is none.
- (Fn [(Ref String a)] (Maybe String)) -
-- (extension p) --
-
gets the extension of a file as a Maybe
.
+ (Fn [(Ref String a)] (Maybe String)) +
++ (extension p) ++
+
gets the extension of a file as a Maybe
.
- (Fn [(Ref String a)] (Maybe String)) -
-- (filename p) --
-
gets the filename of the path p
as a (Maybe String)
.
+ (Fn [(Ref String a)] (Maybe String)) +
++ (filename p) ++
+
gets the filename of the path p
as a (Maybe String)
.
It will return Nothing
if an empty string is passed.
- (Fn [] (Maybe (Array String))) -
-- (get-search-path) --
-
gets the PATH
environment variable and splits it.
+ (Fn [] (Maybe (Array String))) +
++ (get-search-path) ++
+
gets the PATH
environment variable and splits it.
- (Fn [(Ref String a)] Bool) -
-- (has-extension? p) --
-
cheks whether the path p
has an extension.
+ (Fn [(Ref String a)] Bool) +
++ (has-extension? p) ++
+
cheks whether the path p
has an extension.
- (Fn [(Ref String a), (Ref String b)] Bool) -
-- (is-extension? p ext) --
-
checks whether the path p
has the extension ext
.
+ (Fn [(Ref String a), (Ref String b)] Bool) +
++ (is-extension? p ext) ++
+
checks whether the path p
has the extension ext
.
- (Fn [(Ref (Array String) a)] String) -
-- (join ps) --
-
joins the path components ps
into a path.
+ (Fn [(Ref (Array String) a)] String) +
++ (join ps) ++
+
joins the path components ps
into a path.
As such, it is the inverse to split.
- -- Int -
- - - --
defines the maximum path length on this OS.
++ Int +
+ + + ++
defines the maximum path length on this OS.
- -- (Fn [(Ref String a)] Bool) -
-- (relative? p) --
-
checks whether a path is relative.
++ (Fn [(Ref String a)] Bool) +
++ (relative? p) ++
+
checks whether a path is relative.
As such, it is the inverse to absolute?.
- -- (Fn [(Ref String a), (Ref String b)] String) -
-- (replace-extension p ext) --
-
replaces the extension of a path p
with ext
. Adds
+
+ (Fn [(Ref String a), (Ref String b)] String) +
++ (replace-extension p ext) ++
+
replaces the extension of a path p
with ext
. Adds
an extension if there previously was none.
- Char -
- - - --
is the separator for the PATH
environment
+
+ Char +
+ + + ++
is the separator for the PATH
environment
variable we use on this OS.
- (Fn [Char] Bool) -
-- (search-path-separator? c) --
- -
-+ (Fn [Char] Bool) +
++ (search-path-separator? c) ++
+ +
- Char -
- - - --
is the default separator we use on this OS.
+ -- (Fn [(Ref Char StaticLifetime)] Bool) -
-- (separator? c) --
-
checks whether the character c
is a separator for the
+
+ (Fn [(Ref Char StaticLifetime)] Bool) +
++ (separator? c) ++
+
checks whether the character c
is a separator for the
PATH
environment variable on this OS.
- (Array Char) -
- - - --
is the possible separators we could use on this OS.
++ (Array Char) +
+ + + ++
is the possible separators we could use on this OS.
- -- (Fn [(Ref String a)] (Array String)) -
-- (split p) --
-
splits the path p
into its components.
+ (Fn [(Ref String a)] (Array String)) +
++ (split p) ++
+
splits the path p
into its components.
As such, it is the inverse to join.
- -- (Fn [(Ref String a)] (Maybe (Pair String String))) -
-- (split-extension p) --
-
splits the path p
on its extension.
+ (Fn [(Ref String a)] (Maybe (Pair String String))) +
++ (split-extension p) ++
+
splits the path p
on its extension.
It will return a (Maybe (Pair String String))
. Maybe
because there might not
be an extension, and Pair
because it will return the part before and after
the extension.
- (Fn [(Ref String a)] (Array String)) -
-- (split-search-path p) --
-
splits a PATH
environment variable p
.
+ (Fn [(Ref String a)] (Array String)) +
++ (split-search-path p) ++
+
splits a PATH
environment variable p
.