Liking cljdoc? Tell your friends :D

commando.core


build-compilerclj/s

(build-compiler registry instruction)
source

create-registryclj/s

(create-registry registry)

Creates a 'Command' registry from a vector of CommandMapSpecs:

Each command specification (CommandMapSpec) should be a map containing at least:

  • :type - a unique keyword identifying the command type
  • :recognize-fn - a function to recognize the command in the instruction map (fn [element] (and (map? element) (contains? element :your-command-key))
  • :apply - a function to execute the command: (fn [instruction command-map-obj command-data] ...)
  • :dependencies - declare way the command should build dependency {:mode :all-inside} - all commands inside the current map are depednencies {:mode :none} - no dependencies, the other commands may depend from it. {:mode :point :point-key :commando/from} - special type of dependency which declare that current command depends from the command it refer by exampled :commando/from key.

Additional optional keys can include:

  • :validate-params-fn - a function to validate command structures, and catch invalid parameters at the anylisis stage (fn [command-map-obj] (if valid-params? command-map-obj (throw ...))

The function returns a built registry that can be used to resolve Instruction

Example (create-registry [{:type :print :recognize-fn ... :execute-fn ...} commando.commands.builtin/command-fn-spec commando.commands.builtin/command-apply-spec commando.commands.builtin/command-mutation-spec commando.commands.builtin/command-resolve-spec])

Creates a 'Command' registry from a vector of CommandMapSpecs:

 Each command specification (CommandMapSpec) should be a map containing at least:
 - `:type` - a unique keyword identifying the command type
 - `:recognize-fn` - a function to recognize the command in the instruction map
      (fn [element] (and (map? element) (contains? element :your-command-key))
 - `:apply` - a function to execute the command:
      (fn [instruction command-map-obj command-data] ...)
 - `:dependencies` - declare way the command should build dependency
      {:mode :all-inside} - all commands inside the current map are depednencies
      {:mode :none} - no dependencies, the other commands may depend from it.
      {:mode :point :point-key :commando/from} - special type of dependency 
           which declare that current command depends from the command it refer by 
           exampled :commando/from key.

 Additional optional keys can include:
 - `:validate-params-fn` - a function to validate command structures, and catch 
        invalid parameters at the anylisis stage
        (fn [command-map-obj] (if valid-params? command-map-obj (throw ...))

 The function returns a built registry that can be used to resolve Instruction 

Example 
 (create-registry 
   [{:type :print :recognize-fn ... :execute-fn ...}
    commando.commands.builtin/command-fn-spec
    commando.commands.builtin/command-apply-spec
    commando.commands.builtin/command-mutation-spec
    commando.commands.builtin/command-resolve-spec])
sourceraw docstring

executeclj/s

(execute registry-or-compiler instruction)
source

failed?clj/s

(failed? status-map)
source

ok?clj/s

(ok? status-map)
source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close