From 9f05b5ea35ff716978800dfc6d8064885f262d83 Mon Sep 17 00:00:00 2001 From: RayPals Date: Mon, 1 Jun 2026 00:53:43 +0200 Subject: [PATCH] Add docs/PRACTICAL_SCRIPTING.md from Claro v1.17.26 zip --- docs/PRACTICAL_SCRIPTING.md | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 docs/PRACTICAL_SCRIPTING.md diff --git a/docs/PRACTICAL_SCRIPTING.md b/docs/PRACTICAL_SCRIPTING.md new file mode 100644 index 0000000..611120c --- /dev/null +++ b/docs/PRACTICAL_SCRIPTING.md @@ -0,0 +1,66 @@ +# Practical Scripting in Claro + +Claro v1.10.26 includes simple commands that make small automation scripts possible. + +## Arguments + +```claro +COUNT ARGUMENTS AS total +GET ARGUMENT 1 AS first +GET ALL ARGUMENTS AS args +``` + +Run with: + +```bash +claro myscript.claro apple banana +``` + +## Environment + +```claro +GET ENV "PATH" AS path +SAY path +``` + +## Folders and files + +```claro +CREATE FOLDER "output" +WRITE FILE "output/hello.txt" WITH "Hello" +COPY FILE "output/hello.txt" TO "output/copy.txt" +MOVE FILE "output/copy.txt" TO "output/moved.txt" +LIST FOLDER "output" AS files +DELETE FILE "output/hello.txt" +DELETE FILE "output/moved.txt" +DELETE FOLDER "output" +``` + +## Text helpers + +```claro +TEXT UPPER "hello" AS loud +TEXT LOWER "LOUD" AS quiet +TEXT TRIM " neat " AS clean +TEXT LENGTH clean AS size +TEXT CONTAINS "hello world" NEEDLE "world" AS found +``` + +## List helpers + +```claro +SORT names +REVERSE names +FIND "Jon" IN names AS place +REMOVE "Jon" FROM names +``` + +## External commands + +```claro +RUN COMMAND "echo hello" AS output +SAY output +SAY LASTEXIT +``` + +Use this carefully. It runs commands on the user's computer.