Compare commits

...

6 commits

Author SHA1 Message Date
Simon Brooke ab1b868f3f Bother! Forgot to update version in README! 2023-06-11 07:37:16 +01:00
Simon Brooke 6d03aa4dd9 Upversioned to 1.0.2 after merging Sean Corfield's pull requests 2023-06-11 07:32:29 +01:00
Simon Brooke dc3e85946c
Merge pull request #1 from seancorfield/patch-1
Update README.md
2023-06-11 07:25:35 +01:00
Simon Brooke e25d93bde9
Merge pull request #2 from seancorfield/patch-2
Ensure gecos string has at least two fields
2023-06-11 07:24:56 +01:00
Sean Corfield 63125d6ee5
Ensure gecos string has at least two fields
For a `gecos` string like `,,,`, `clojure.string/split` produces `[]` so `interleave` produces an empty result (it stops on the shortest sequence) and so the `apply assoc` fails with two few arguments.

This ensures that the `gecos` string will always produce a non-empty result from the `split` so the rest works.

Note that `(split "a,,," #",")` produces `["a"]` -- the empty trailing elements are ignored/dropped.
2023-06-10 22:58:19 -07:00
Sean Corfield 08dc3dbd98
Update README.md
Fix required ns name
2023-06-10 22:54:05 -07:00
3 changed files with 5 additions and 5 deletions

View file

@ -22,14 +22,14 @@ there did not seem to be any other ways to do it.
If building from Leiningen, add to project dependencies If building from Leiningen, add to project dependencies
```clojure ```clojure
[org.clojars.simon_brooke/real-name "1.0.1"] [org.clojars.simon_brooke/real-name "1.0.2"]
``` ```
Add the following requirement to your namespace: Add the following requirement to your namespace:
```clojure ```clojure
(ns your.fine.namespace (ns your.fine.namespace
(:require [cc.journeyman.real-name :refer [get-real-name]])) (:require [cc.journeyman.real-name.core :refer [get-real-name]]))
``` ```
Resolve usernames to real names by invoking `(get-real-name)`, either without Resolve usernames to real names by invoking `(get-real-name)`, either without

View file

@ -1,4 +1,4 @@
(defproject org.clojars.simon_brooke/real-name "1.0.1" (defproject org.clojars.simon_brooke/real-name "1.0.2"
:codox {:metadata {:doc "**TODO**: write docs" :codox {:metadata {:doc "**TODO**: write docs"
:doc/format :markdown} :doc/format :markdown}
:output-path "docs" :output-path "docs"

View file

@ -33,7 +33,7 @@
"Process this `gecos` field into a map of its sub-fields. See "Process this `gecos` field into a map of its sub-fields. See
https://en.wikipedia.org/wiki/Gecos_field" https://en.wikipedia.org/wiki/Gecos_field"
[gecos] [gecos]
(delimited-record->map gecos #"," [:real-name :address :work-phone :home-phone :other])) (delimited-record->map (str gecos ",?") #"," [:real-name :address :work-phone :home-phone :other]))
(defn process-passwd-line (defn process-passwd-line
"Process this `line` from a passwd file" "Process this `line` from a passwd file"