mirror of
https://github.com/sagiegurari/duckscript
synced 2024-07-03 07:18:36 +00:00
docs
This commit is contained in:
parent
8e28042997
commit
35dcb18269
1116
docs/sdk.md
1116
docs/sdk.md
File diff suppressed because it is too large
Load Diff
|
@ -4,16 +4,16 @@ doc_file = internal::sdkdocs [prefix] output_file
|
|||
|
||||
Generates markdown documentation of all known commands and writes them into the provided file.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* Optional name prefix
|
||||
* The target file name which will hold the generated documentation.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The target file name.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
doc_file = internal::sdkdocs ./docs/sdk.md
|
||||
|
|
|
@ -6,15 +6,15 @@ Creates an array from the input arguments and returns a handle to that array.<br
|
|||
This handle can be passed to other commands which support arrays using handles.<br>
|
||||
Once the array is no longer used, it should be released using the **release** command.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
Any number of arguments which will construct the array.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
A handle to the array.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = array ${var} "hello world" 5 ${another_var}
|
||||
|
|
|
@ -4,15 +4,15 @@ result = array_clear handle
|
|||
|
||||
Clears the provided array.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The array handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if successful.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = array
|
||||
|
|
|
@ -4,15 +4,15 @@ handle = array_concat [handle]*
|
|||
|
||||
Concats all provided arrays and returns a handle to a new array with all items.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
Any number of array handles.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
A handle to the new array.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
input1 = range 1 4
|
||||
|
|
|
@ -5,16 +5,16 @@ var = array_contains handle value
|
|||
Returns the first index of the array with the same value as provided.<br>
|
||||
If not found, false will be returned.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The array handle.
|
||||
* The value
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The value index in the array or false if not found.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = array value1 value2 value3
|
||||
|
|
|
@ -4,16 +4,16 @@ var = array_get handle index
|
|||
|
||||
Returns the element from the array at a given index or none if the index is bigger than the array length.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The array handle.
|
||||
* The element index.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The element at the given index from the array or none.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = array 1 2 3
|
||||
|
|
|
@ -4,15 +4,15 @@ var = array_is_empty handle
|
|||
|
||||
Returns true if the provided array handle is an empty array.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The array handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the provided handle belongs to an empty array.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
values = array
|
||||
|
|
|
@ -4,16 +4,16 @@ var = array_join handle separator
|
|||
|
||||
Joins all values in the provided array with the provided separator in between each value.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* An array handle
|
||||
* The separator to put between each item pair
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The joined string value
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
function test_to_string
|
||||
|
|
|
@ -4,15 +4,15 @@ var = array_length handle
|
|||
|
||||
Returns the array length based on the provided array handle.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The array handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The array length.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = array a b c "d e"
|
||||
|
|
|
@ -4,15 +4,15 @@ var = array_pop handle
|
|||
|
||||
Returns the last element of the array or none if the array is empty.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The array handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The last element of the array or none if the array is empty.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = array 1 2 3
|
||||
|
|
|
@ -4,15 +4,15 @@ var = array_push handle value
|
|||
|
||||
Pushes an additional value to an existing array.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The array handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if a new value was pushed.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = array 1 2 3
|
||||
|
|
|
@ -6,16 +6,16 @@ Removes the item from the array at the given index.<br>
|
|||
If the array is not found or the index is greater than the array size, this command will return false.<br>
|
||||
Otherwise it will return true.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The array handle.
|
||||
* The element index.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if successful.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
arr = array old
|
||||
|
|
|
@ -6,17 +6,17 @@ Updates the array at a given index with the provided value.<br>
|
|||
If the array is not found or the index is greater than the array size, this command will return false.<br>
|
||||
Otherwise it will return true.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The array handle.
|
||||
* The element index.
|
||||
* The element value.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if successful.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
arr = array old
|
||||
|
|
|
@ -4,15 +4,15 @@ var = is_array handle
|
|||
|
||||
Returns true if the provided value is an array handle.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The array handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the provided value is an array handle.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
arr = array 1 2 3
|
||||
|
|
|
@ -4,15 +4,15 @@ var = is_map handle
|
|||
|
||||
Returns true if the provided value is a map handle.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The map handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the provided value is a map handle.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
map_handle = map
|
||||
|
|
|
@ -4,15 +4,15 @@ var = is_set handle
|
|||
|
||||
Returns true if the provided value is a set handle.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The set handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the provided value is a set handle.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = set_new 1 2 3
|
||||
|
|
|
@ -6,15 +6,15 @@ Creates an empty map and returns a handle to that array.<br>
|
|||
This handle can be passed to other commands which support maps using handles.<br>
|
||||
Once the map is no longer used, it should be released using the **release** command.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
A handle to the map.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,15 +4,15 @@ result = map_clear handle
|
|||
|
||||
Clears the provided map.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The map handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if successful.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,16 +4,16 @@ var = map_contains_key handle key
|
|||
|
||||
Returns true if the provided key was found in the map.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The map handle.
|
||||
* The key
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the key was found in the map.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,16 +4,16 @@ var = map_contains_value handle value
|
|||
|
||||
Returns true if the provided value was found in the map.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The map handle.
|
||||
* The value
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the value was found in the map.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,16 +4,16 @@ value = map_get handle key
|
|||
|
||||
Returns a the value corresponding to the key from the map.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The map handle.
|
||||
* The key.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The value corresponding to the key from the map.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,15 +4,15 @@ var = map_is_empty handle
|
|||
|
||||
Returns true if the provided map handle is an empty map.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The map handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the provided handle belongs to an empty map.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,15 +4,15 @@ keys = map_keys handle
|
|||
|
||||
Returns a handle to an array holding all keys in the provided map handle.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The map handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
A handle to an array holding all map keys.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,17 +4,17 @@ var = map_load_properties [--prefix prefix] handle text
|
|||
|
||||
Parsers and loads all properties to the provided map.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* Optional --prefix and the prefix value
|
||||
* The map handle.
|
||||
* The properties text.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if successful.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,17 +4,17 @@ var = map_put handle key value
|
|||
|
||||
Inserts a key-value pair into the map.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The map handle.
|
||||
* The key.
|
||||
* The new value.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if a new value was inserted.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,16 +4,16 @@ value = map_remove handle key
|
|||
|
||||
Removes a the value corresponding to the key from the map and returns it.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The map handle.
|
||||
* The key.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The value corresponding to the key from the map.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,15 +4,15 @@ var = map_size handle
|
|||
|
||||
Returns the map size based on the provided map handle.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The map handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The map size.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -4,16 +4,16 @@ text = map_to_properties [--prefix prefix] handle
|
|||
|
||||
Converts the provided map to properties text.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* Optional --prefix and the prefix value
|
||||
* The map handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The properties text.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = map
|
||||
|
|
|
@ -6,16 +6,16 @@ Creates an array from the input start and end range values and returns a handle
|
|||
This handle can be passed to other commands which support arrays using handles.<br>
|
||||
Once the array is no longer used, it should be released using the **release** command.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The start numeric value
|
||||
* The end numeric value which cannot be smaller than the start value.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
A handle to the array.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = range 1 10
|
||||
|
|
|
@ -6,16 +6,16 @@ Parses the properties (based on java properties format) text and sets them as va
|
|||
This command will also return the count of properties read.<br>
|
||||
If prefix is provided, all properties read, will be stored as variables with the **prefix.** as their prefix.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* Optional --prefix and the prefix value
|
||||
* The text to parse.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The properties count.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
count = read_properties "a=1\nb=2\na.b.c=3"
|
||||
|
|
|
@ -6,15 +6,15 @@ Creates a new set from the input arguments and returns a handle to that set.<br>
|
|||
This handle can be passed to other commands which support sets using handles.<br>
|
||||
Once the set is no longer used, it should be released using the **release** command.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
Any number of arguments which will construct the set.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
A handle to the set.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = set_new ${var} "hello world" 5 ${another_var}
|
||||
|
|
|
@ -4,15 +4,15 @@ result = set_clear handle
|
|||
|
||||
Clears the provided set.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The set handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if successful.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = set
|
||||
|
|
|
@ -4,16 +4,16 @@ var = set_contains handle value
|
|||
|
||||
Returns true if the set contains the provided value.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The set handle.
|
||||
* The value
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the value was found in the set.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = set_new value1 value2 value3
|
||||
|
|
|
@ -4,15 +4,15 @@ set_handle = set_from_array array_handle
|
|||
|
||||
Returns a set handle created from the provided array values.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The array handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The new set handle.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
array_handle = array value1 value2 value3
|
||||
|
|
|
@ -4,15 +4,15 @@ var = set_is_empty handle
|
|||
|
||||
Returns true if the provided set handle is an empty set.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The set handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the provided handle belongs to an empty set.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = set
|
||||
|
|
|
@ -4,15 +4,15 @@ var = set_put handle value
|
|||
|
||||
Pushes an additional value to an existing set.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The set handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if a new value was pushed.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = set_new 1 2 3
|
||||
|
|
|
@ -4,16 +4,16 @@ removed = set_remove handle value
|
|||
|
||||
Removes a the value from the set and returns true/false if it was removed.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The set handle.
|
||||
* The value to remove.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the value was found and removed from the set.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = set_new
|
||||
|
|
|
@ -4,15 +4,15 @@ var = set_size handle
|
|||
|
||||
Returns the set size based on the provided set handle.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The set handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The set size.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = set
|
||||
|
|
|
@ -4,15 +4,15 @@ array_handle = set_to_array set_handle
|
|||
|
||||
Converts the provided set to an array and returns the new array handle.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The set handle.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The array handle or false in case of error.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
set_handle = set_new value1 value2 value3
|
||||
|
|
|
@ -4,16 +4,16 @@ text = write_properties [--prefix prefix] [names]
|
|||
|
||||
Creates a properties string from the provided list of variable names (not values).
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* Optional prefix which will be added to all written properties.
|
||||
* A list of variable names.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The properties text value.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
a = set 1
|
||||
|
|
|
@ -4,15 +4,15 @@ var = duckscript_sdk_version
|
|||
|
||||
Returns the duckscript SDK version.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The duckscript SDK version.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
version = duckscript_sdk_version
|
||||
|
|
|
@ -4,15 +4,15 @@ var = duckscript_version
|
|||
|
||||
Returns the duckscript runtime version.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The duckscript runtime version.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
version = duckscript_version
|
||||
|
|
|
@ -4,15 +4,15 @@ value = dump_instructions
|
|||
|
||||
Returns all script instructions structure (not script text) in textual form.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The script instructions.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
value = dump_instructions
|
||||
|
|
|
@ -4,15 +4,15 @@ value = dump_state
|
|||
|
||||
Returns all script state in textual form.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The script state.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
numbers = range -5 15
|
||||
|
|
|
@ -4,15 +4,15 @@ value = dump_variables
|
|||
|
||||
Returns all script variables in textual form.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The script variables.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
one = set 1
|
||||
|
|
|
@ -5,15 +5,15 @@ echo [arg]*
|
|||
The echo command will printout all provided arguments.<br>
|
||||
After all input is done, an end of line will be printed as well.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
Any number of arguments may be provided and will be printed.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The amount of arguments printed.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# Print multiple arguments:
|
||||
|
|
|
@ -4,15 +4,15 @@ var = cpu_count
|
|||
|
||||
Returns the number of CPUs.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The CPU count.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
count = cpu_count
|
||||
|
|
|
@ -4,15 +4,15 @@ handle = env_to_map
|
|||
|
||||
Converts all environment variables to a map and returns the map handle.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The map handle.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
set_env env_to_map_test test_value
|
||||
|
|
|
@ -4,15 +4,15 @@ var = get_env key
|
|||
|
||||
Returns the environment variable value for the provided key.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
First argument is the environment variable key.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The environment variable value.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
home = get_env HOME
|
||||
|
|
|
@ -5,15 +5,15 @@ var = get_home_dir
|
|||
Returns the user home directory path.<br>
|
||||
In case of any error, false will be returned.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The user home directory path or false in case of any error.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
directory = get_home_dir
|
||||
|
|
|
@ -4,15 +4,15 @@ var = whoami
|
|||
|
||||
Returns the current user name.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The current user name.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
name = whoami
|
||||
|
|
|
@ -4,15 +4,15 @@ var = is_windows
|
|||
|
||||
Returns true if the current OS family is windows.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the current OS family is windows.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
windows = is_windows
|
||||
|
|
|
@ -4,15 +4,15 @@ var = os_family
|
|||
|
||||
Returns the OS family (windows, linux, mac).
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The OS family (windows, linux, mac).
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
name = os_family
|
||||
|
|
|
@ -4,15 +4,15 @@ var = os_name
|
|||
|
||||
Returns the OS name.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The OS name.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
name = os_name
|
||||
|
|
|
@ -5,15 +5,15 @@ var = os_release
|
|||
Returns the OS release.<br>
|
||||
**This command is not supported on windows.**
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The OS release.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
release = os_release
|
||||
|
|
|
@ -5,15 +5,15 @@ var = os_version
|
|||
Returns the OS version.<br>
|
||||
**This command is not supported on windows.**
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The OS version.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
version = os_version
|
||||
|
|
|
@ -4,15 +4,15 @@ var = pwd
|
|||
|
||||
Prints and also returns the current directory.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The current directory path.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# Print the current directory:
|
||||
|
|
|
@ -4,15 +4,15 @@ var = printenv
|
|||
|
||||
Prints and returns all environment variables.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
All environment variables printout text.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
set_env TEST_PRINT_ENV TRUE
|
||||
|
|
|
@ -6,15 +6,15 @@ Sets the current directory based on the input path.<br>
|
|||
If no path is provided, it will default to the user home directory.<br>
|
||||
If the path does not exist, it will return none.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The new current directory.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The new current directory or none in case of any error such as target directory not found.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# Move to user home directory and store the path in the home variable
|
||||
|
|
|
@ -5,7 +5,7 @@ var = set_env (key value | --handle map_handle)
|
|||
Sets the environment variable defined by the provided key to the provided value.<br>
|
||||
If --handle is provided, the second arg will be used as a handle to a map and all keys/values in the map will be set.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The function can be invoked in the following ways:
|
||||
* Key/Value pair - Two arguments are required:
|
||||
|
@ -15,11 +15,11 @@ The function can be invoked in the following ways:
|
|||
* --handle
|
||||
* The map handle
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
true if successful
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
set_env HOME /usr/me
|
||||
|
|
6
duckscript_sdk/src/sdk/std/env/uname/help.md
vendored
6
duckscript_sdk/src/sdk/std/env/uname/help.md
vendored
|
@ -4,15 +4,15 @@ var = uname [-a]
|
|||
|
||||
Acts similar to uname on unix like systems.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* Optional -a for extended information (not supported on windows).
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The OS name and optionally extra information.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
value = uname -a
|
||||
|
|
6
duckscript_sdk/src/sdk/std/env/unset/help.md
vendored
6
duckscript_sdk/src/sdk/std/env/unset/help.md
vendored
|
@ -4,15 +4,15 @@ unset_env key
|
|||
|
||||
Removes the environment variable defined by the provided key.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The name of the environment variable to remove
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
None
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
unset_env HOME
|
||||
|
|
6
duckscript_sdk/src/sdk/std/env/which/help.md
vendored
6
duckscript_sdk/src/sdk/std/env/which/help.md
vendored
|
@ -5,15 +5,15 @@ var = which executable
|
|||
Returns the path to the executable if it exists.<br>
|
||||
If not found it will return an empty string.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The executable to find.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The executable path or empty string if not found.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
path = which echo
|
||||
|
|
|
@ -5,15 +5,15 @@ eval command arguments
|
|||
The eval command enables to run dynamically created commands.<br>
|
||||
The command and arguments passed can be variables in the form of ${name}.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
Any number of arguments which will construct a line to evaluate and execute.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The result of the evaluated line.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
command = set echo
|
||||
|
|
|
@ -10,7 +10,7 @@ The for/in command enables to iterate over an array (see [array command](#std__c
|
|||
The first argument will contain the current iteration value from the array.<br>
|
||||
Once all values have been read, it will exit the loop.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* for
|
||||
* The variable name which will hold the current iteration value
|
||||
|
@ -18,11 +18,11 @@ Once all values have been read, it will exit the loop.
|
|||
* The handle to the array of values to iterate
|
||||
* end - no parameters
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
None
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# Simple example iteration over the list of letters:
|
||||
|
|
|
@ -34,7 +34,7 @@ All variables defined will not be available except the variables provided to the
|
|||
All variables created during the function invocation will be deleted once the function ends, except the return value.<br>
|
||||
This enables a clean function invocation without impacting the global variables.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* function - The function name used later on to invoke the function
|
||||
* end - no parameters
|
||||
|
@ -42,11 +42,11 @@ This enables a clean function invocation without impacting the global variables.
|
|||
* *<scope>* - Optional annotation which enables to use a new scope during the function invocation.
|
||||
* *function name* - Any number of arguments which will automatically be set as global variables: ${1}, ${2}, ... as so on.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The function invocation returns the output provided by the return command.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# Simple example of a function definition which echo 'hello world' and exits.
|
||||
|
|
|
@ -4,15 +4,15 @@ goto :label
|
|||
|
||||
The goto command enables you to jump to any position in the script, if that position has a label value.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
A single valid label value.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
None
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
goto :good
|
||||
|
|
|
@ -38,16 +38,16 @@ if blocks can be nested in other if blocks (see examples).
|
|||
A condition statement is made up of values, or/and keywords and '('/')' groups.<br>
|
||||
Each must be separated with a space character.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* if/elseif - A command and its arguments to invoke and evaluate its output, if a single value is provided an no such command exists, it is evaluated as a value.
|
||||
* else/end - no parameters
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
None
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# Simple example of an if statement that evaluates the argument value as true and echos "in if"
|
||||
|
|
|
@ -32,16 +32,16 @@ while blocks can be nested in other while blocks (see examples).
|
|||
A condition statement is made up of values, or/and keywords and '('/')' groups.<br>
|
||||
Each must be separated with a space character.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* while - A command and its arguments to invoke and evaluate its output, if a single value is provided an no such command exists, it is evaluated as a value.
|
||||
* end - no parameters
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
None
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
top_count = set 0
|
||||
|
|
|
@ -7,16 +7,16 @@ It will return true/false value based if it was able to write the text to the fi
|
|||
In case the file doesn't exist, it will create it.<br>
|
||||
If the file exists, it will append the text to it.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The target file
|
||||
* The text content to write
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
true/false based if it was able to write the text to the file.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
out = appendfile ./target/tests/writefile.txt "line 1\nline 2"
|
||||
|
|
|
@ -5,15 +5,15 @@ var = basename path
|
|||
This command will return the last path element of the provided path.<br>
|
||||
If unable, it will return none.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The path to extract the last element from.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The last path element or none if unsuccessful.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
file = basename ./dir/file.txt
|
||||
|
|
|
@ -5,15 +5,15 @@ var = canonicalize path
|
|||
This command will return the c path for the provided input.<br>
|
||||
In case unable, it will return the original input.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The file/directory path to canonicalize.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The canonicalized path, or if unsuccessful, the original path.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
path = canonicalize ./target
|
||||
|
|
|
@ -5,16 +5,16 @@ var = cp source target
|
|||
This command copies the requested file or directory to the target location.<br>
|
||||
If the source directory is not empty, its entire contents will be copied as well.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The source path to copy
|
||||
* The target path
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
**true** if the path was copied.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# copy a single file
|
||||
|
|
|
@ -4,16 +4,16 @@ result = glob_cp source_glob target
|
|||
|
||||
This command will copy all files that match the given glob.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The source glob, for example ./*.txt
|
||||
* The target path
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The amount of paths (files) copied or false in case of any error.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
count = glob_cp ./**/*.txt ../target
|
||||
|
|
|
@ -5,15 +5,15 @@ var = dirname path
|
|||
This command will return the parent path of the provided path.<br>
|
||||
If the parent path is empty, it will return none.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The path to extract the parent path from.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The parent path or none.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
directory = dirname ./dir/file.txt
|
||||
|
|
|
@ -4,15 +4,15 @@ var = is_path_exists path
|
|||
|
||||
This command will return true/false based if the provided path points to an existing file system entry.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The path to check.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the path points to an existing file system entry.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
existing = is_path_exists ./dir
|
||||
|
|
|
@ -4,15 +4,15 @@ var = get_last_modified_time path
|
|||
|
||||
This command will return the last modified time in millies from unix epoch.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The path to check.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The last modified time in millies from unix epoch or false in case path does not exist.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
time = get_last_modified_time ./dir/somefile.txt
|
||||
|
|
|
@ -4,15 +4,15 @@ handle = gitignore_path_array path
|
|||
|
||||
Returns an array handle containing all path entries found from the provided root path that should be included based on the gitignore definitions.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The root path.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The array handle.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = gitignore_path_array ./src
|
||||
|
|
|
@ -5,15 +5,15 @@ handle = glob_array pattern
|
|||
Returns an array handle containing all path entries found from the provided glob pattern.<br>
|
||||
The pattern can be a relative path from current directory or an absolute path.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The glob pattern.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The array handle.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = glob_array ./somedir/**/*.txt
|
||||
|
|
|
@ -4,15 +4,15 @@ var = is_dir path
|
|||
|
||||
This command will return true/false based if the provided path points to an existing directory.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The path to check.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the path points to an existing directory.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
existing_dir = is_dir ./dir
|
||||
|
|
|
@ -4,15 +4,15 @@ var = is_file path
|
|||
|
||||
This command will return true/false based if the provided path points to an existing file.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The path to check.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the path points to an existing file.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
existing_file = is_file ./dir/somefile.txt
|
||||
|
|
|
@ -4,17 +4,17 @@ var = is_path_newer newer older
|
|||
|
||||
This command will return true if the 'newer' path last modified time is after the 'older' path last modified time.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* newer - The file/directory path to check.
|
||||
* older - The file/directory path to check.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the 'newer' path last modified time is after the 'older' path last modified time.
|
||||
Otherwise or in case of an error, false will be returned.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
newer = is_path_newer ./new_file.txt ./old_file.txt
|
||||
|
|
|
@ -4,15 +4,15 @@ var = is_readonly path
|
|||
|
||||
This command will return true/false based if the provided path exists and is set to readonly.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The path to check.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
True if the provided path exists and is set to readonly.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
readonly = is_readonly ./dir/somefile.txt
|
||||
|
|
|
@ -4,15 +4,15 @@ result = join_path path [path]*
|
|||
|
||||
Concats all paths and makes sure there is a / character between each path element.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* A list of paths to join
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The joined path
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
joined = join_path /test /dir1 /dir2 dir3 //dir4// /dir5
|
||||
|
|
|
@ -8,16 +8,16 @@ The supported flags are:
|
|||
|
||||
* -l - Shows extended information
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* Optional flags (currently only -l is supported)
|
||||
* Optional path (if not provided, current working directory is used)
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
**true** is operation was successful.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# prints current directory content
|
||||
|
|
|
@ -4,15 +4,15 @@ var = mkdir directory
|
|||
|
||||
This command will create the requested directory (and needed parent directories) and return true/false if it was successful.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The directory name to create.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The operation success value - true if directory exists, else false.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
exists = mkdir ./dir/subdir
|
||||
|
|
|
@ -9,16 +9,16 @@ This command moves the requested source path to the target path.
|
|||
|
||||
All missing parent directories in the target path will be created as needed.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The source path to copy
|
||||
* The target path
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
**true** if the move was successful.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# move a single file
|
||||
|
|
|
@ -5,15 +5,15 @@ var = cat [file]+
|
|||
The cat command will print out the requested file/s.<br>
|
||||
In addition it will also return the value to the output variable.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
Multiple file paths.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The file content or none if the file does not exist.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
cat ./docs/sdk.md
|
||||
|
|
|
@ -4,15 +4,15 @@ handle = read_binary_file file
|
|||
|
||||
Reads a raw file and returns a handle to the binary data.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
A single parameter holding the file path.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The binary data handle.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = read_binary_file ./Cargo.toml
|
||||
|
|
|
@ -4,15 +4,15 @@ var = readfile file
|
|||
|
||||
The readfile command will read the requested file and return the value to the output variable.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
A single parameter holding the file path.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The file content or none in case file does not exist.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
text = readfile ./Cargo.toml
|
||||
|
|
|
@ -5,16 +5,16 @@ var = rm [-r] [path]+
|
|||
This command delete the requested file/s, empty directories or recursively deletes directories
|
||||
and all their content (files and sub directories) if the **-r** flag is provided.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* Optional flags (currently only -r is supported which indicates recursive deletion)
|
||||
* The path/s to delete
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
**true** if all paths were deleted.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# delete a file or empty directory
|
||||
|
|
|
@ -5,15 +5,15 @@ var = rmdir path
|
|||
This command delete the requested empty directory and returns true if successful.<br>
|
||||
If the path leads to a file or a directory which is not empty, this command will fail.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
A single parameter holding the directory path.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
**true** if the directory was deleted.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
deleted = rmdir ./mydir
|
||||
|
|
|
@ -5,16 +5,16 @@ result = chmod mode path
|
|||
This command will update the mode for the given path.<br>
|
||||
**This command is currently only available for unix like systems and will return false for all others such as windows.**
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The new mode, for example 755
|
||||
* The path
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The new mode as decimal number or false in case of any error.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
chmod 777 ./myfile.txt
|
||||
|
|
|
@ -5,16 +5,16 @@ result = glob_chmod mode glob
|
|||
This command will update the mode for the given glob pattern.<br>
|
||||
**This command is currently only available for unix like systems and will return false for all others such as windows.**
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The new mode, for example 755
|
||||
* The path glob
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The amount of path entries affected by the operation or false in case of any error.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
file1 = set ./target/_duckscript_test/glob_chmod/modify1.txt
|
||||
|
|
|
@ -4,15 +4,15 @@ path = temp_dir
|
|||
|
||||
This command will return the system temporary directory path.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The directory path.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
path = temp_dir
|
||||
|
|
|
@ -4,15 +4,15 @@ path = temp_file [extension]
|
|||
|
||||
This command will create a new empty temporary file and return its path.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
Optional file extension.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
The file path.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
path = temp_file toml
|
||||
|
|
|
@ -5,16 +5,16 @@ var = touch file
|
|||
This command will create an empty file and return true/false if the file exists.<br>
|
||||
If file exits, it will not be modified.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
The file path.
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
If the file exists after the command, it will return true.<br>
|
||||
In case of any error, it will return false.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
exists = touch ./dir/file.txt
|
||||
|
|
|
@ -5,16 +5,16 @@ result = write_binary_file file handle
|
|||
This command enables to write binary data of the provided binary handle into the requested file.<br>
|
||||
It will return true/false value based if it was able to write the binary data to the file.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The target file
|
||||
* The binary data handle
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
true/false based if it was able to write the binary data to the file.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
handle = string_to_bytes "some text"
|
||||
|
|
|
@ -5,16 +5,16 @@ result = writefile file text
|
|||
This command enables to write the provided text into the requested file.<br>
|
||||
It will return true/false value based if it was able to write the text to the file.
|
||||
|
||||
#### Parameters
|
||||
### Parameters
|
||||
|
||||
* The target file
|
||||
* The text content to write
|
||||
|
||||
#### Return Value
|
||||
### Return Value
|
||||
|
||||
true/false based if it was able to write the text to the file.
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
result = writefile ./target/tests/writefile.txt "line 1\nline 2"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user