### Installing Stable CacheBox via CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/wirebox/system/cache/readme.md Installs the latest stable release of the CacheBox library using the CommandBox package manager. This requires CommandBox to be installed and configured on your system. The command downloads and places the CacheBox files into the project's `lib` directory. ```CommandBox CLI box install cachebox ``` -------------------------------- ### Installing Bleeding Edge CacheBox via CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/wirebox/system/cache/readme.md Installs the latest bleeding-edge build of the CacheBox library using the CommandBox package manager. This method is useful for testing the most recent features or bug fixes. It requires CommandBox to be installed and configured, and downloads the bleeding-edge artifact into the project's `lib` directory. ```CommandBox CLI box install cachebox-be ``` -------------------------------- ### Installing LogBox via CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/wirebox/system/logging/readme.md This snippet provides the CommandBox commands for installing the LogBox library. It includes commands for installing the stable release and the bleeding edge release using the `box install` command. ```CommandBox box install logbox box install logbox@be ``` -------------------------------- ### Install Stable WireBox via CommandBox Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/wirebox/system/ioc/readme.md This command uses the CommandBox CLI and package manager to install the latest stable release of the WireBox framework. It is the recommended installation method. ```CommandBox box install wirebox ``` -------------------------------- ### Running Native Binary CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Execute any native binary or system command from the CommandBox prompt by prefixing it with an exclamation mark !. This example runs the java -version command to check the installed Java version. ```CommandBox CLI !java -version ``` -------------------------------- ### Starting Server by Name CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Start a previously registered CommandBox server using its assigned name. This allows you to manage servers from any directory, not just the server's webroot. ```CommandBox CLI start foo ``` -------------------------------- ### Installing Globber Library via CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/globber/readme.md Provides the CommandBox command required to install the Globber library as a project dependency. This command is executed from the CommandBox command line interface. ```CommandBox CLI install globber ``` -------------------------------- ### Listing Installed Packages CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Display a list of packages installed as dependencies for the current project, as defined in the box.json file. This helps manage project dependencies. ```CommandBox CLI list ``` -------------------------------- ### Install Bleeding Edge WireBox via CommandBox Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/wirebox/system/ioc/readme.md This command installs the latest bleeding edge version of the WireBox framework using the CommandBox package manager. This version includes the most recent changes but may not be fully stable. ```CommandBox box install wirebox-be ``` -------------------------------- ### Executing CFML Function now CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Run a CFML function directly from the CommandBox prompt using the '#' prefix. This example executes the now() function to get the current date and time. ```CFML #now ``` -------------------------------- ### Listing System Modules CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt View a list of modules that are installed globally with CommandBox. These modules extend CommandBox functionality and are available across all projects. ```CommandBox CLI list --system ``` -------------------------------- ### Installing JMESPath via CommandBox Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Provides the command-line instruction to install the JMESPath library using the CommandBox package manager. This is the primary method for adding the dependency to a ColdFusion project. Requires CommandBox CLI installed. ```Shell $ box install jmespath ``` -------------------------------- ### Using Globbing with touch CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Demonstrate the use of file globbing patterns with the touch command. This example updates the timestamp or creates all files in the current directory ending with the .txt extension. ```CommandBox CLI touch *.txt ``` -------------------------------- ### Executing CFML Function hash CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Execute a CFML function with parameters directly from the CommandBox prompt. This example calls the hash() function with the string argument "foo". ```CFML #hash foo ``` -------------------------------- ### Using Globbing with dir CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Demonstrate the use of file globbing patterns with the dir command. This example lists all files in the current directory ending with the .txt extension. ```CommandBox CLI dir *.txt ``` -------------------------------- ### Array Slicing with Step CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Shows how to use array slicing with start, end, and step values (`[start:end:step]`) in a JMESPath expression to extract a reverse-ordered subset of an array. The example `[10:0:-1]` reverses the entire array. Uses the `JMESPath.search` method. Requires the `jmespath` library. ```CFML var data = { foo: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], bar: { baz: 1 } }; JMESPath.search(data, 'foo[10:0:-1]'); // [9,8,7,6,5,4,3,2,1] ``` -------------------------------- ### Managing Properties with Methods in CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/propertyFile/readme.md Shows how to interact with properties using the dedicated methods provided by the `PropertyFile` object, including setting a value, getting a value (with or without a default), and checking for the existence of a property key. This is the recommended approach to avoid conflicts with built-in method names. ```CFML propertyFile.set( 'myProp', 'myValue' ); propertyFile.get( 'myProp' ); propertyFile.get( 'anotherProp', 'defaultValue' ); propertyFile.exists( 'questionableProp' ); ``` -------------------------------- ### Listing Cached Artifacts CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt View a list of cached artifacts on disk that CommandBox has downloaded, such as server JARs or package zips. CommandBox uses this cache for faster installations and offline use. ```CommandBox CLI artifacts list ``` -------------------------------- ### Applying Closure to Matched Files Using Globber (CFML) Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/globber/readme.md Illustrates how to use the `globber` transient to find files matching a pattern and then apply a custom closure function to each matched file path using the `.apply()` method. The example demonstrates deleting markdown files found within a specific folder. ```CFML wirebox.getInstance( 'globber' ) .setPattern( 'C:/myFolder/*.md' ) .apply( function( path ) { fileDelete( path ); } ); ``` -------------------------------- ### Using Globbing with rm CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Demonstrate the use of file globbing patterns with the rm command. This example removes all files in the current directory ending with the .txt extension. ```CommandBox CLI rm *.txt ``` -------------------------------- ### Running Snake Game CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Start a simple ASCII snake game directly within the CommandBox terminal. This is a fun Easter egg feature. ```CommandBox CLI snake ``` -------------------------------- ### Define CommandBox Task Function in CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules_app/task-commands/templates/TaskContent.txt Defines a CommandBox task component. It includes a single placeholder function `|targetName|` which serves as a task target. Executing this target will print a success message to the console. This serves as a minimal example for creating CommandBox tasks. ```CFML component { /** * */ function |targetName|() { print.greenLine( 'Complete!' ); } } ``` -------------------------------- ### Stopping Server and Forgetting CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Use this command to stop a running CommandBox server and remove its persistent registration, preventing it from showing up in future server lists unless explicitly started again. This is useful for temporary servers. ```CommandBox CLI stop --forget ``` -------------------------------- ### Initializing and Basic Nested Search CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Shows two ways to obtain the JMESPath component instance: using WireBox dependency injection or direct instantiation. It then demonstrates calling the `search` method with a simple struct and a dot-notation JMESPath expression ('foo.bar'). The expected output {baz: "value"} is shown in comments. Requires the `jmespath` library. ```CFML property name="JMESPath" inject="jmespath"; //wirebox JMESPath = new models.JmesPath(); //Instantiate Object JMESPath.search({ foo: { bar: { baz: "value" }}}, 'foo.bar') //{baz: "value"} ``` -------------------------------- ### Finding Files Using Globber Transient (CFML) Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/globber/readme.md Shows how to instantiate the transient `globber` object from WireBox, set a glob pattern using `.setPattern()`, and execute `.matches()` to retrieve an array of file paths on the filesystem that match the specified pattern. The pattern can include recursive matching (e.g., `**`). ```CFML var results = wirebox.getInstance( 'globber' ) .setPattern( 'C:/myFolder/**/*bar.txt' ) .matches(); ``` -------------------------------- ### Tailing Server Log CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt This command displays the live log output of the running server associated with the current directory. The --follow flag ensures new log entries are shown as they occur, similar to the Unix tail -f command. ```CommandBox CLI server log --follow ``` -------------------------------- ### Loading Properties File in CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/propertyFile/readme.md Demonstrates how to instantiate the `PropertyFile` utility and load the contents of a specified Java properties file into memory for manipulation. Requires the full path to the `.properties` file. ```CFML var propertyFile = getInstance( 'propertyFile' ).load( expandPath( 'myFile.properties' ) ); ``` -------------------------------- ### Retrieving Globber Results as Query (CFML) Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/globber/readme.md Shows how to change the output format of the `globber` transient from an array to a query object by adding the `.asQuery()` method before the `.matches()` call in the fluent chain. The structure and columns of the returned query match those from the built-in `directoryList()` function. ```CFML var qryResults = globber .setPattern( baseDir & '/**' ) .asQuery() .matches(); ``` -------------------------------- ### Watching TestBox Tests CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Run your TestBox unit tests and automatically re-run them whenever relevant files change. This provides live feedback during development. ```CommandBox CLI testbox watch ``` -------------------------------- ### Changing Directory to Server Webroot CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Quickly change the current working directory to the webroot of a registered CommandBox server named myServer. This is a convenient shortcut for navigating to server-specific project directories. ```CommandBox CLI server cd myServer ``` -------------------------------- ### Multiselect List and Hash CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Illustrates the multiselect feature to extract multiple elements from a structure. `.[prop1, prop2]` creates a list (array) of specified properties. `.{key1: prop1, key2: prop2}` creates a hash (struct) with specified keys mapping to selected properties. Uses the `JMESPath.search` method. Requires the `jmespath` library. ```CFML var data = { foo: { bar: 1, baz: [2, 3, 4], buz: 2 } }; JMESPath.search(data, 'foo.[bar,baz[0]]'); // [1,2] JMESPath.search(data, 'foo.[bar,baz[1]]'); // [1,3] JMESPath.search(data, 'foo.{bar: bar, buz: buz}'); // {"bar":1,"buz":2} ``` -------------------------------- ### Formatting JSON String with JSONPrettyPrint CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/JSONPrettyPrint/README.md Demonstrates basic usage of the JSONPrettyPrint library by obtaining an instance using `getInstance` and calling the `formatJSON` method with a JSON string as input. This is the simplest way to format a pre-existing JSON string. ```CFML var formatted = getInstance( 'JSONPrettyPrint' ).formatJSON( '{ "foo" : "bar" }' ); ``` -------------------------------- ### Using PathPatternMatcher Service with WireBox (CFML) Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/globber/readme.md Demonstrates how to obtain the singleton `PathPatternMatcher` service from WireBox and use its methods (`matchPattern`, `matchPatterns`) to check if specific file paths match one or more glob patterns. This service performs pattern matching against strings and does not interact with the filesystem. ```CFML var pathPatternMatcher = wirebox.getInstance( 'PathPatternMatcher@globber' ); pathPatternMatcher.matchPattern( '/foo/*', '/foo/bar' ); pathPatternMatcher.matchPatterns( [ '/foo/*', '**.txt' ], '/foo/bar' ); ``` -------------------------------- ### Listing Local Servers CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt View a list of CommandBox servers that are registered locally to the current directory. This helps identify which servers are associated with your project workspace. ```CommandBox CLI server list --local ``` -------------------------------- ### Formatting JSON with Options in JSONPrettyPrint CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/JSONPrettyPrint/README.md Illustrates how to customize the formatting output by passing optional arguments to the `formatJSON` method. Options include specifying the `indent` characters, the `lineEnding` characters (e.g., using `chr(10)` for LF), or `sortKeys` (`'text'` or `'textnocase'`) to order keys alphabetically. ```CFML var formatted = getInstance( 'JSONPrettyPrint' ).formatJSON( json={ foo : 'bar' }, indent=' ', lineEnding=chr( 10 ) ); ``` ```CFML var formatted = getInstance( 'JSONPrettyPrint' ).formatJSON( json={ b: 1, a: 2 }, sortKeys='text' ); ``` -------------------------------- ### Chaining PropertyFile Operations in CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/propertyFile/readme.md Illustrates how multiple method calls on the `PropertyFile` object can be chained together for a more concise syntax. Most methods that do not return a specific value return the object instance itself, enabling this fluent API style. ```CFML getInstance( 'propertyFile' ) .load( myPath ) .set( 'myProp', 'myValue' ) .set( 'myOtherProp', 'myOtherValue' ) .store(); ``` -------------------------------- ### Running TestBox Tests CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Execute your TestBox unit test suite from the CommandBox CLI. This is commonly used for local testing or in continuous integration environments. ```CommandBox CLI testbox run ``` -------------------------------- ### Injecting JSONPrettyPrint into CFML Component Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/JSONPrettyPrint/README.md Demonstrates how to inject the JSONPrettyPrint library into a CFML component using WireBox. By declaring a property with the `inject` attribute, WireBox provides an instance of the singleton library, making it readily available for use within the component's functions. ```CFML component { property name='JSONPrettyPrint' inject; function writeJSON( required JSON, required path ) { fileWrite( path, JSONPrettyPrint.formatJSON( JSON ) ); } } ``` -------------------------------- ### Managing Properties with Struct-like Access in CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/propertyFile/readme.md Illustrates an alternative method to interact with properties by treating the `PropertyFile` object like a standard CFML struct. While convenient, note potential issues with property names conflicting with method names or when using dot notation with periods in keys, which can create nested structs incorrectly. ```CFML propertyFile.myProp = 'myValue'; propertyFile.myProp; propertyFile.anotherProp ?: 'defaultValue'; structKeyExists( propertyFile, 'questionableProp' ); ``` -------------------------------- ### Basic Property and Wildcard Access CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Demonstrates accessing nested properties (`foo`, `foo.bar`) and using the wildcard (`*.bar`) in JMESPath expressions to extract data from a ColdFusion struct. Shows how different expressions return different parts of the nested structure. Uses the `JMESPath.search` method. Requires the `jmespath` library. ```CFML var data = { foo: { bar: { baz: 'correct' } } }; JMESPath.search(data, 'foo'); // {"bar":{"baz":"correct"}} JMESPath.search(data, 'foo.bar'); // {"baz":"correct"} JMESPath.search(data, '*.bar'); // {"baz":"correct"} ``` -------------------------------- ### Basic Comparison Search CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Illustrates using comparison operators (`<`, `==`) directly in JMESPath expressions to evaluate conditions on numeric values within a struct. The `search` method returns a boolean result. Requires the `jmespath` library. ```CFML var data = { one: 1, two: 2, three: 3 }; JMESPath.search(data, 'one < two'); // true JMESPath.search(data, 'one == two'); // false ``` -------------------------------- ### Iterating Properties in CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/propertyFile/readme.md Explains how to retrieve all properties from the loaded file as a standard CFML struct and then iterate over them to access each property key and value. Useful for processing all properties programmatically. ```CFML var myStruct = propertyFile.getAsStruct(); for( var prop in myStruct ) { writeDump( myStruct[ prop ] ); } ``` -------------------------------- ### Sorting Globber Results (CFML) Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/globber/readme.md Demonstrates how to sort the results returned by the `globber` transient using the `.withSort()` method. This allows sorting by columns compatible with `directoryList()` (e.g., `type`, `name`) and specifying the sort direction (ascending or descending), applicable to both array and query results. ```CFML var qryResults = globber .setPattern( baseDir & '/**' ) .withSort( 'type asc, name desc' ) .matches(); ``` -------------------------------- ### Injecting Alternate JSON Formatter in CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/JSONPrettyPrint/README.md Shows how to inject a specific alternate formatter implementation from the JSONPrettyPrint library using the `inject="alias@mapping"` syntax. This allows selecting a different underlying formatter, such as the Lucee 5 native formatter for potential performance benefits, bypassing the default selection logic. ```CFML component { property name='JSONPrettyPrint' inject="CFMLPrinter@JSONPrettyPrint"; function writeJSON( required JSON, required path ) { fileWrite( path, JSONPrettyPrint.formatJSON( JSON ) ); } } ``` -------------------------------- ### Array Wildcard and Index Search CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Demonstrates searching a structure containing an array of structs, each with a nested array. It uses the wildcard `[*]` to select all items in the outer array and the index `[1]` to select the second item from the nested `bar` arrays, returning an array of the results. Uses the `JMESPath.search` method. Requires the `jmespath` library. ```CFML var data = { foo: [{ bar: ['one', 'two'] }, { bar: ['three', 'four'] }, { bar: ['five'] }] }; JMESPath.search(data, 'foo[*].bar[1]'); // ["two","four"] ``` -------------------------------- ### Scaffolding Task Runner CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Generate a new CFC file boilerplate for creating a custom Task Runner. Task Runners allow you to automate build tasks and scripts using CFML. ```CommandBox CLI task create ``` -------------------------------- ### Searching JSON Files and Content CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Demonstrates passing a file path (resolved using `expandPath`) or the raw string content of a JSON file directly as the data argument to the `JMESPath.search` method. The library handles reading and parsing the JSON automatically in these cases. Requires the `jmespath` library and access to the file system. ```CFML JMESPath.search(expression, expandPath('/path/to/data.json')); fileContent = fileRead(expandPath('./path/to/data.json'), 'utf-8'); JMESPath.search(expression, fileContent); ``` -------------------------------- ### Updating Dependencies CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Update all project dependencies listed in your box.json file to their latest compatible versions. This command helps keep your project's libraries current. ```CommandBox CLI update ``` -------------------------------- ### Using Current Element Identifier CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Demonstrates the use of the `@` identifier in JMESPath expressions, which refers to the current element being processed. It shows how `@` alone returns the entire input data and how it can be combined with other expressions like `.bar` or `.foo[0]` to navigate from the root. Uses the `JMESPath.search` method. Requires the `jmespath` library. ```CFML var data = { foo: [{ name: 'a' }, { name: 'b' }], bar: { baz: 'qux' } }; JMESPath.search(data, '@'); // {"foo":[{"name":"a"},{"name":"b"}],"bar":{"baz":"qux"}} JMESPath.search(data, '@.bar'); // {"baz":"qux"} JMESPath.search(data, '@.foo[0]'); // {"name":"a"} ``` -------------------------------- ### Changing Directory to Home CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Change the current working directory within the CommandBox shell to the user's home directory. This command works consistently across different operating systems, including Windows. ```CommandBox CLI cd ~ ``` -------------------------------- ### Storing Properties to Original File in CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/propertyFile/readme.md Shows the method call required to save the current state of the `PropertyFile` object (including any modifications) back to the original `.properties` file that was loaded initially. The method takes no arguments for this operation. ```CFML propertyFile.store(); ``` -------------------------------- ### Pipelining Expressions CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Demonstrates using the pipe operator (`|`) to chain JMESPath expressions. The expression first extracts all nested `bar` arrays from the `foo` array, and then pipes the result into a second expression `[0][0]` to select the first element of the first array returned by the first part. Uses the `JMESPath.search` method. Requires the `jmespath` library. ```CFML var data = { foo: [{ bar: [{ baz: 'one' }, { baz: 'two' }] }, { bar: [{ baz: 'three' }, { baz: 'four' }] }] }; JMESPath.search(data, 'foo[*].bar[*] | [0][0]'); // {"baz":"one"} ``` -------------------------------- ### Checking ForgeBox Login CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Verify if you are currently logged in to ForgeBox from the CommandBox CLI. This is necessary for publishing packages to ForgeBox. ```CommandBox CLI forgebox whoami ``` -------------------------------- ### Setting Package Properties CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Modify properties and settings for your project's box.json file directly from the CLI. This command allows you to configure package metadata and dependencies without manual file editing. ```CommandBox CLI package set ``` -------------------------------- ### Setting Server Properties CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Modify properties and settings for a CommandBox server directly from the CLI. This command allows you to configure server behavior without manually editing the server.json file. ```CommandBox CLI server set ``` -------------------------------- ### Viewing Command History CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Display a list of commands previously executed in the CommandBox shell. This helps you remember and reuse past commands. ```CommandBox CLI history ``` -------------------------------- ### Modifying Property File CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt Script modifications to Java-style property files directly from the CommandBox CLI. This is useful for automating configuration changes in properties files. ```CommandBox CLI propertyfile set ``` -------------------------------- ### Filtering Arrays with Conditions CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Shows how to use filter expressions `[?condition]` to select elements from an array that meet a specified condition. Demonstrates various comparison operators (`>`, `>=`, `<`, `<=`, `==`, `!=`) used within filters, with numbers quoted using backticks (`) in the JMESPath expression. Uses the `JMESPath.search` method. Requires the `jmespath` library. ```CFML var data = { foo: [{ age: 20 }, { age: 25 }, { age: 30 }] }; JMESPath.search(data, 'foo[?age > `25`]'); // [{"age":30}] JMESPath.search(data, 'foo[?age >= `25`]'); // [{"age":25},{"age":30}] JMESPath.search(data, 'foo[?age > `30`]'); // [] JMESPath.search(data, 'foo[?age < `25`]'); // [{"age":20}] JMESPath.search(data, 'foo[?age <= `25`]'); // [{"age":20},{"age":25}] JMESPath.search(data, 'foo[?age < `20`]'); // [] JMESPath.search(data, 'foo[?age == `20`]'); // [{"age":20}] JMESPath.search(data, 'foo[?age != `20`]'); // [{"age":25},{"age":30}] ``` -------------------------------- ### Stopping All Servers CommandBox CLI Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/Quotes.txt This command stops all currently running CommandBox servers. It's a convenient way to shut down multiple server instances simultaneously without stopping each one individually. ```CommandBox CLI stop --all ``` -------------------------------- ### Array Indexing and Negative Indices CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/jmespath/README.md Shows how to access specific elements within a nested array using zero-based positive indices (e.g., `[2]`) and negative indices (e.g., `[-1]`) which count from the end of the array. Demonstrates that accessing an out-of-bounds index returns `null`. Uses the `JMESPath.search` method. Requires the `jmespath` library. ```CFML var data = { foo: { bar: ['zero', 'one', 'two'] } }; JMESPath.search(data, 'foo.bar[2]'); // "two" JMESPath.search(data, 'foo.bar[3]'); // null JMESPath.search(data, 'foo.bar[-1]'); // "two" ``` -------------------------------- ### Storing Properties to New File in CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/propertyFile/readme.md Demonstrates how to save the current properties held by the object to a different file path than the one originally loaded. This can be used to save changes to a new location or to save a newly created properties object. ```CFML propertyFile.store( expandPath( 'myNewFile.properties' ) ); ``` -------------------------------- ### Comparing Strings and Displaying Results CFML Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/string-similarity/readme.md This snippet demonstrates how to use the `stringSimilarity` function to compare two multi-line strings in ColdFusion. It defines the strings, calls the function with a difference threshold (10), and then outputs the comparison results, including the distance, similarity percentage, longest common string (LCS), and the modified strings with differences highlighted, formatted within an HTML table. ```CFML Roughly #comparison_result.distance# characters are different between the two strings.
The strings are a #numberformat(comparison_result.similarity*100)#% match.
The Longest Common String is #comparison_result.lcs#.

#replacenocase(comparison_result.s1,chr(10),"
","all")#
#replacenocase(comparison_result.s2,chr(10),"
","all")#
``` -------------------------------- ### Formatting CFML Struct with JSONPrettyPrint Source: https://github.com/ortus-solutions/commandbox/blob/development/src/cfml/system/modules/JSONPrettyPrint/README.md Shows how to use the `formatJSON` method with a native CFML struct or array. The library automatically serializes the CFML object to JSON before applying the formatting rules. This is useful when working directly with CFML data structures. ```CFML var formatted = getInstance( 'JSONPrettyPrint' ).formatJSON( { foo : 'bar' } ); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.