The CodeSnack IDE CLI (cs
) is a utility designed to enhance your workflow by allowing you to interact with CodeSnack IDE directly from your terminal. This lightweight tool bridges the gap between your Cloud Container terminal and your physical device (iOS/Android), enabling you to transfer text and manipulate files across environments. Most notably, it allows you to copy text from the terminal in your cloud environment directly to the clipboard on the device where you're running the CodeSnack IDE app.
The cs
utility comes pre-installed in your CodeSnack IDE Cloud Container environment. No additional installation steps are required.
The CLI provides the following core commands:
Command | Description |
---|---|
cs open <file> |
Open a specific file in the CodeSnack IDE editor |
cs clip read |
Read content from the device clipboard |
cs clip write [text] |
Write content to the device clipboard |
cs kill |
Restart a Cloud Container |
cs help |
Display help information |
Open a specific file in the CodeSnack IDE editor:
cs open index.html
This will send a request to the IDE to open index.html
in the editor, allowing you to quickly switch to editing a file you found via terminal commands.
The clipboard commands provide a seamless bridge between your Cloud Container terminal and your physical device's clipboard.
To retrieve the current contents of your iOS/Android device clipboard:
cs clip read
This command fetches whatever is currently in your physical device's clipboard and outputs it to your terminal, making it easy to use that data in your cloud environment.
The cs clip write
command offers multiple ways to copy content from your cloud terminal directly to your iOS/Android device's clipboard:
Direct text input:
cs clip write "Hello, CodeSnack IDE!"
Pipe content from another command:
cat index.html | cs clip write
Redirect file content:
cs clip write < index.html
Copy command output:
ls -la | cs clip write
Copy multi-line content:
cs clip write "Line 1
Line 2
Line 3"
To stop the Cloud Container daemon and restart a Container:
cs kill
This command requires sudo permissions and uses systemd to stop the daemon service.
Combine cs
commands with standard terminal utilities for efficient workflows between your cloud environment and your physical device:
# Find all TODO comments and copy them to your iOS/Android device clipboard
grep -r "TODO" --include="*.js" . | cs clip write
# Copy the result of a build process to your device for sharing
npm run build | cs clip write
# Open a file found via find command in the IDE
find . -name "config.json" -exec cs open {} \;
Move content between your cloud environment and your iOS/Android device clipboard easily:
# Extract a specific section from a log file and copy to your device clipboard
sed -n '10,20p' app.log | cs clip write
# Copy environment variables from cloud to your device for sharing
env | grep NODE | cs clip write
# Save your device clipboard content to a file in your cloud environment
cs clip read > saved_clipboard.txt