Skip to content

Commit

Permalink
format: use shell for code blocks, add missing clojure language to co…
Browse files Browse the repository at this point in the history
…de blocks
  • Loading branch information
practicalli-johnny committed Mar 1, 2024
1 parent 9a63c3b commit 593c285
Show file tree
Hide file tree
Showing 54 changed files with 143 additions and 145 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- dev: checkout v4 & python v5 actions in publish-book workflow
- dev: sparse checkout scheduled version workflow
- dev: upload-artefact v4 & remove explicit token from megalinter
- format: use shell for code blocks, add missing clojure language to code blocks

## Added
- button link to Clojure CLI releases changelog to view available versions
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,34 +81,34 @@ Publish book workflow installs Material for MkDocs version 9

Install mkdocs version 9 using the Python pip package manager

```bash
```shell
pip install mkdocs-material=="9.*"
```

Install the plugins used by the Practicalli site using Pip (these are also installed in the GitHub Action workflow)

```bash
```shell
pip3 install mkdocs-material mkdocs-callouts mkdocs-glightbox mkdocs-git-revision-date-localized-plugin mkdocs-redirects pillow cairosvg
```

> pillow and cairosvg python packages are required for [Social Cards](https://squidfunk.github.io/mkdocs-material/setup/setting-up-social-cards/)
Fork the GitHub repository and clone that fork to your computer,

```bash
```shell
git clone https://github.com/<your-github-account>/<repository>.git
```

Run a local server from the root of the cloned project

```bash
```shell
make docs
```

The website will open at <http://localhost:8000>

If making smaller changes, then only rebuild the content that changes, speeding up the local development process
```bash
```shell
make docs-changed
```

2 changes: 1 addition & 1 deletion docs/alternative-tools/clojure-cli/basic-repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Use `clj` when you want to run a repl (or preferably use [rebel readline](rebel-

`clj` command in a terminal window starts a Clojure REPL and shows the version of Clojure used. The command does not need to be in a directory containing a Clojure project.

```bash
```shell
clj
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This expression calls the `+` function with the arguments `1 2 3 4 5`. As this
Using the `-e` option an expression can be passed to the Clojure CLI tools and a value returned


```bash
```shell
clojure -e (+ 1 2 3 4 5)
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Switching to a specific namespace in the REPL allows calling functions by name,

To require and switch to a namespace on startup, use the `clojure` or `clj` commands with the --eval option to run the specific commands. The --repl option will ensure the repl starts.

```bash
```shell
clj --eval "(require 'practicalli.random-clojure-core-function)" --eval "(in-ns 'practicalli.random-clojure-core-function)" --repl
```


`-r` or `(clojure.main/repl)` are the same as using the `--repl` option

```bash
```shell
clj -e "(ns foo.bar) (alter-var-root #'*ns* (constantly 'foo.bar))" -r
clj -e "(ns foo.bar) (alter-var-root #'*ns* (constantly 'foo.bar)) (clojure.main/repl)"
```
Expand Down
4 changes: 2 additions & 2 deletions docs/alternative-tools/data-inspector/reveal.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Use Reveal with a terminal REPL or a Clojure editor that uses nrepl such as Emac

Open a terminal and run the command:

```bash
```shell
clojure -M:inspect/reveal
```
> Use the `clj` command if the `rlwrap` binary is available
Expand Down Expand Up @@ -105,7 +105,7 @@ Reveal can be used as a `tap>` target with the Rebel REPL, launching the Reveal

Start Rebel REPL with Reveal library as a dependency

```bash
```shell
clojure -M:repl-reveal:repl/rebel
```

Expand Down
12 changes: 6 additions & 6 deletions docs/alternative-tools/leiningen/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Install the Leiningen tool using the specific instructions for your Operating Sy
=== "Linux"
[Download the lein script](https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein) to your local `bin` directory. Then make the `lein` script executable and run `lein` to download the full version.

```bash
```shell
mkdir ~/bin
curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > ~/bin/lein
chmod u+x ~/bin/lein
Expand All @@ -29,7 +29,7 @@ Install the Leiningen tool using the specific instructions for your Operating Sy
=== "Homebrew"
If you have [Homebrew](https://brew.sh/) installed, run the following command in a terminal window.

```bash
```shell
brew install leiningen
```

Expand All @@ -51,7 +51,7 @@ Install the Leiningen tool using the specific instructions for your Operating Sy

If you have [Chocolatey](https://chocolatey.org/) installed, add the [Leiningen package](https://chocolatey.org/packages/Lein) by running the following command in a terminal window.

```bash
```shell
choco install lein
```

Expand All @@ -71,7 +71,7 @@ Install the Leiningen tool using the specific instructions for your Operating Sy

Check Leiningen is working by running `lein` command in a terminal

```bash
```shell
lein help
```

Expand Down Expand Up @@ -104,13 +104,13 @@ Leiningen automatically includes the `test` directory when running, so no additi

Run all the tests saved to file:

```bash
```shell
lein test
```

Run just the unit tests in a specific namepsace.

```bash
```shell
lein test :only domain.namespace-test
```

Expand Down
2 changes: 1 addition & 1 deletion docs/clojure-cli/defining-aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ clojure -X:project/run

Over-ride the default arguments by passing them on the command line

```bash
```shell
clojure -X:project/run '[:http/server :port]' 8888 :log/mulog :console :profile :dev
```

Expand Down
32 changes: 16 additions & 16 deletions docs/clojure-cli/execution-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The double quotes in an EDN string must be wrapped by single quotes, along with

Run a project with the main namespace `practicalli.sudoku-solver`, without any additional aliases on the command line

```bash
```shell
clojure -M -m practicalli.sudoku-solver
```

Expand All @@ -63,7 +63,7 @@ Adding a `:project/run` alias to the project `deps.edn` file provides a simpler

Now the project code can be run using the simple command line form

```bash
```shell
clojure -M:project/run
```

Expand Down Expand Up @@ -97,7 +97,7 @@ If no -main function is found or the namespace is not specified, then a REPL ses

Use the `:repl/rebel` alias with the `-M` execution option

```bash
```shell
clojure -M:repl/rebel
```

Expand All @@ -109,7 +109,7 @@ Multiple aliases can be specified to include additional paths and libraries. Ali

Start a REPL process with this alias

```bash
```shell
clojure -M:env/dev:lib/hotload:repl/rebel
```

Expand All @@ -120,7 +120,7 @@ The Rebel REPL UI will start, include the dev directory on the class path and th

Alises can be used together by chaining their names on the command line

```bash
```shell
clojure -M:env/dev:lib/hotload:repl/rebel
```

Expand All @@ -139,13 +139,13 @@ Any function on the class path can be called and is passed a hash-map as an argu

Call the `status` function from the namespace `practicalli.service`, which is on the classpath in the practicalli.service project

```bash
```shell
clojure -X practicalli.service/status
```

Pass arguments to a `start` function in the `practicalli.service` namespace

```bash
```shell
clojure -X practicalli.service/start :port 8080 :join? false
```

Expand All @@ -170,7 +170,7 @@ The `-T` execution option also uses the `clojure.exec` approach, although the `:

Calling Tools on the command line has the general form:

```bash
```shell
clojure -Ttool-name function-name :key "value" ,,,
```

Expand All @@ -183,27 +183,27 @@ key/value pairs can be passed as arguments to that function (as with the -X exec

In this example, the antq tool is installed using the name `antq`

```bash
```shell
clojure -Ttools install com.github.liquidz/antq '{:git/tag "1.3.1"}' :as antq
```

Installing a tool adds an EDN configuration file using the name of the tool in `$XDG_HOME/.clojure/tools/` or `$HOME/.clojure/tools/` directory.

Once a tool is installed, run by using the name of the tool.

```bash
```shell
clojure -Tantq outdated
```

Options to the tool are passed as key/value pairs (as the tool is called by clojure.exec)

```bash
```shell
clojure -Tantq outdated :upgrade true
```

`-Ttools remove` will remove the configuration of the tool of the given name

```bash
```shell
clojure -Ttools remove :tool antq
```

Expand Down Expand Up @@ -265,13 +265,13 @@ If `:git` or `:local/root` dependencies are defined, the respective code will be

Prepare flag by itself download dependencies defined in the `:deps` section of the `deps.edn` file of the current project.

```bash
```shell
clojure -P
```

Including one or more aliases will preparing all the dependencies from every alias specified

```bash
```shell
clojure -P -M:env/dev:lib/hotload:repl/cider
```

Expand All @@ -290,7 +290,7 @@ As prepare is essentially a dry run, then the `clojure` command does not call `:
The `:env/dev` alias adds "dev" directory to the class path, [typically used to add a `user.clj` that will automatically load code from the `user` namespace defined in that file](https://practical.li/clojure/clojure-cli/projects/configure-repl-startup.html).

```bash
```shell
clojure -A:env/dev
```

Expand All @@ -310,7 +310,7 @@ Aliases can be chained together and their configuration will be merged

Start a REPL process with this alias

```bash
```shell
clojure -A:env/dev:lib/hotload
```

Expand Down
2 changes: 1 addition & 1 deletion docs/clojure-cli/practicalli-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ All tools are provided via libraries and are only installed on first use. Unuse

Run project with or without an alias:

```bash
```shell
clojure -M:alias -m domain.app-name
clojure -M -m domain.app-name
```
Expand Down
8 changes: 4 additions & 4 deletions docs/clojure-cli/projects/templates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Create a project using the `:project/create` alias.

The `practicalli/minimal` template and `practicalli/playground` name are used if `:template` and `:name` arguments are not specified.

```bash
```shell
clojure -T:project/create
```

Expand All @@ -78,7 +78,7 @@ Use the form `domain/app-or-lib-name` to specify a project name, typically with

Create a project using the `practicalli/application` template and random-function name.

```bash
```shell
clojure -T:project/create :template practicalli/application :name practicalli/random-function
```

Expand All @@ -87,7 +87,7 @@ clojure -T:project/create :template practicalli/application :name practicalli/ra

Change into the directory and test the project runs by starting a REPL with [Terminal REPL](/clojure/clojure-cli/repl/)

```bash
```shell
cd playground && clojure -M:repl/rebel
```

Expand All @@ -108,7 +108,7 @@ Type code expressions at the repl prompt and press RETURN to evaluate them.

Run project with or without an alias:

```bash
```shell
clojure -M:alias -m domain.app-name
clojure -M -m domain.app-name
```
Expand Down
4 changes: 2 additions & 2 deletions docs/clojure-cli/repl-startup.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Create an alias to include the `dev` path when running a REPL process

Run a Clojure REPL with the `:repl/reloaded` alias (or `:dev/reloaded` `:dev/env`) to add the `dev` directory to the class path and load the code in `dev/user.clj` file into the REPL.

```bash
```shell
clojure -M:repl/reloaded
```

Expand Down Expand Up @@ -320,7 +320,7 @@ Rather than restart the repl, clojure.tools.namespace.repl provides functions th

Start a REPL session using Clojure CLI with `:repl/reloaded`, `dev/reloaded` or `:lib/hotload` aliases

```bash
```shell
clojure -M:repl/reloaded
```

Expand Down
6 changes: 3 additions & 3 deletions docs/clojure-cli/repl/libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ Open a terminal and change to the root of the Clojure project directory, where t

Start the REPL including the `:database/h2` alias to include every library defined in the `:deps` key and libraries in the `:database/h2` alias. This example is using rebel readline rich terminal UI

```bash
```shell
clojure -M:repl/rebel
```

This command will include

Add aliases to include optional libraries, such as those used for development. In this example, the H2 database and next.jdbc libraries are included along with those libraries in the `:deps` key of `deps.edn`

```bash
```shell
clojure -M:database/h2:repl/rebel
```

Expand Down Expand Up @@ -86,7 +86,7 @@ If errors occur when loading or reloading the namespace with require, the `:verb

Start a REPL session using Clojure CLI with the [`:lib/hotload alias`](/clojure/clojure-cli/repl-reloaded/), including rebel readline for an enhance REPL terminal UI.

```bash
```shell
clojure -M:lib/hotload:repl/rebel
```

Expand Down
Loading

0 comments on commit 593c285

Please sign in to comment.