tolitius / mount

managing Clojure and ClojureScript app state since (reset)
Eclipse Public License 1.0
1.22k stars 88 forks source link

Add docstring for defstate #83

Closed kenrestivo closed 7 years ago

kenrestivo commented 7 years ago

I keep forgetting the syntax for this. Rather than having to go diving for the README all the time, would be good to have this vital information. in the docstring.

arichiardi commented 7 years ago

Very good addition :+1:

tolitius commented 7 years ago

agree, thanks!

NOBLES5E commented 6 years ago

@tolitius Can an example usage of docstring be shown in the project README? Otherwise people won't know they can add docstring.

==== Oh sorry I thought this PR means I can add docstring for a state until I read the code.. Is there anyway to add docstring?...

tolitius commented 6 years ago
dev=> (doc mount/defstate)
-------------------------
mount.core/defstate
([state & body])
Macro
  Defines a state. Restarts on recompilation.
   Pass ^{:on-reload :noop} to prevent auto-restart
   on ns recompilation, or :stop to stop on recompilation.
dev=> (defstate answer
        "answer to the ultimate question of life universe and everything"
        :start (+ 1 41))
#'dev/answer
dev=> (mount/start #'dev/answer)
{:started ["#'dev/answer"]}
dev=> answer
42
dev=> (doc answer)
-------------------------
dev/answer
  answer to the ultimate question of life universe and everything

you mean something like this?

NOBLES5E commented 6 years ago

Exactly. Thanks!!