3 Commits
0.0.1 ... 0.0.2

Author SHA1 Message Date
c822d2142e release 0.0.3 2020-02-12 11:43:10 +01:00
b80015bc4d update for new carp 2020-02-12 11:42:14 +01:00
b343ce830b add license 2020-01-25 16:36:33 +01:00
4 changed files with 42 additions and 21 deletions

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Veit Heller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -5,7 +5,7 @@ is a simple file path library for Carp.
## Installation ## Installation
```clojure ```clojure
(load "https://veitheller.de/git/carpentry/path@0.0.1") (load "https://veitheller.de/git/carpentry/path@0.0.2")
``` ```
### Usage ### Usage

View File

@@ -31,7 +31,7 @@
<div class="module-description"> <div class="module-description">
<p>is a simple file path library for Carp.</p> <p>is a simple file path library for Carp.</p>
<h2>Installation</h2> <h2>Installation</h2>
<pre><code class="language-clojure">(load &quot;https://veitheller.de/git/carpentry/path@0.0.1&quot;) <pre><code class="language-clojure">(load &quot;https://veitheller.de/git/carpentry/path@0.0.2&quot;)
</code></pre> </code></pre>
<h3>Usage</h3> <h3>Usage</h3>
<p>The <code>Path</code> module mostly operates on <code>String</code> arguments. It allows you to <p>The <code>Path</code> module mostly operates on <code>String</code> arguments. It allows you to
@@ -70,7 +70,7 @@ has some functions to work with the <code>PATH</code> environment variable.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] (Maybe String)) (λ [(Ref String a)] (Maybe String))
</p> </p>
<pre class="args"> <pre class="args">
(absolute p) (absolute p)
@@ -90,7 +90,7 @@ has some functions to work with the <code>PATH</code> environment variable.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] Bool) (λ [(Ref String a)] Bool)
</p> </p>
<pre class="args"> <pre class="args">
(absolute? p) (absolute? p)
@@ -111,7 +111,7 @@ has some functions to work with the <code>PATH</code> environment variable.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String, &amp;String] String) (λ [(Ref String a), (Ref String b)] String)
</p> </p>
<pre class="args"> <pre class="args">
(add-extension p ext) (add-extension p ext)
@@ -131,7 +131,7 @@ has some functions to work with the <code>PATH</code> environment variable.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] String) (λ [(Ref String a)] String)
</p> </p>
<pre class="args"> <pre class="args">
(basename p) (basename p)
@@ -172,7 +172,7 @@ which it can fail are OS-dependent, but it should happen relatively rare.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] String) (λ [(Ref String a)] String)
</p> </p>
<pre class="args"> <pre class="args">
(drop-extension p) (drop-extension p)
@@ -193,7 +193,7 @@ is none.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] (Maybe String)) (λ [(Ref String a)] (Maybe String))
</p> </p>
<pre class="args"> <pre class="args">
(extension p) (extension p)
@@ -213,7 +213,7 @@ is none.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] (Maybe String)) (λ [(Ref String a)] (Maybe String))
</p> </p>
<pre class="args"> <pre class="args">
(filename p) (filename p)
@@ -254,7 +254,7 @@ is none.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] Bool) (λ [(Ref String a)] Bool)
</p> </p>
<pre class="args"> <pre class="args">
(has-extension? p) (has-extension? p)
@@ -274,7 +274,7 @@ is none.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String, &amp;String] Bool) (λ [(Ref String a), (Ref String b)] Bool)
</p> </p>
<pre class="args"> <pre class="args">
(is-extension? p ext) (is-extension? p ext)
@@ -294,7 +294,7 @@ is none.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [(Ref (Array String))] String) (λ [(Ref (Array String) a)] String)
</p> </p>
<pre class="args"> <pre class="args">
(join ps) (join ps)
@@ -335,7 +335,7 @@ is none.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] Bool) (λ [(Ref String a)] Bool)
</p> </p>
<pre class="args"> <pre class="args">
(relative? p) (relative? p)
@@ -356,7 +356,7 @@ is none.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String, &amp;String] String) (λ [(Ref String a), (Ref String b)] String)
</p> </p>
<pre class="args"> <pre class="args">
(replace-extension p ext) (replace-extension p ext)
@@ -437,7 +437,7 @@ variable we use on this OS.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;Char] Bool) (λ [(Ref Char StaticLifetime)] Bool)
</p> </p>
<pre class="args"> <pre class="args">
(separator? c) (separator? c)
@@ -478,7 +478,7 @@ variable we use on this OS.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] (Array String)) (λ [(Ref String a)] (Array String))
</p> </p>
<pre class="args"> <pre class="args">
(split p) (split p)
@@ -499,7 +499,7 @@ variable we use on this OS.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] (Maybe (Pair String String))) (λ [(Ref String a)] (Maybe (Pair String String)))
</p> </p>
<pre class="args"> <pre class="args">
(split-extension p) (split-extension p)
@@ -536,7 +536,7 @@ the extension.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] (Array String)) (λ [(Ref String a)] (Array String))
</p> </p>
<pre class="args"> <pre class="args">
(split-search-path p) (split-search-path p)

View File

@@ -3,7 +3,7 @@
## Installation ## Installation
```clojure ```clojure
(load \"https://veitheller.de/git/carpentry/path@0.0.1\") (load \"https://veitheller.de/git/carpentry/path@0.0.2\")
``` ```
### Usage ### Usage
@@ -85,7 +85,7 @@ It will return `Nothing` if an empty string is passed.")
(doc basename "gets the basename of the path `p`.") (doc basename "gets the basename of the path `p`.")
(defn basename [p] (defn basename [p]
(let [split (split p) (let [split (split p)
but-last (Array.prefix-array &split (dec (Array.length &split)))] but-last (Array.prefix &split (dec (Array.length &split)))]
(String.join sep-string &but-last))) (String.join sep-string &but-last)))
(doc split-extension "splits the path `p` on its extension. (doc split-extension "splits the path `p` on its extension.
@@ -113,7 +113,7 @@ Examples on POSIX:
(let [i (Pattern.find extension-pat p)] (let [i (Pattern.find extension-pat p)]
(if (= -1 i) (if (= -1 i)
(Maybe.Nothing) (Maybe.Nothing)
(Maybe.Just (Pair.init (prefix-string p i) (suffix-string p (inc i))))))) (Maybe.Just (Pair.init (prefix p i) (suffix p (inc i)))))))
(doc extension "gets the extension of a file as a `Maybe`.") (doc extension "gets the extension of a file as a `Maybe`.")
(defn extension [p] (defn extension [p]