-
-
Notifications
You must be signed in to change notification settings - Fork 75
Messages
You can think of xplr
as a server. Like web servers listen to HTTP requests, xplr
listens to messages.
xplr
generally reads messages from multiple sources like keyboard input and pipes. Hence, you can control each xplr
session in many ways.
As of writing, xplr
supports the following messages
Explore the present working directory and register the filtered nodes. This operation is expensive. So, try avoiding using it too often. Once exploration is done, it will auto Refresh the state.
Refresh the app state (uncluding UI). But it will not re-explore the directory if the working directory is the same. If there is some change in the working directory and you want to re-explore it, use the Explore message instead.
Clears the screen.
Focus next node.
Focus on the nth node relative to the current focus where n is a given value.
Example: FocusNextByRelativeIndex: 2
Focus on the nth node relative to the current focus where n is read from the input buffer.
Focus on the previous item.
Focus on the -nth node relative to the current focus where n is a given value.
Example: FocusPreviousByRelativeIndex: 2
Focus on the -nth node relative to the current focus where n is read from the input buffer.
Focus on the first node.
Focus on the last node.
Focus on the given path.
Example: FocusPath: /tmp
Focus on the path read from input buffer.
Focus on the absolute nth node where n is a given value.
Example: FocusByIndex: 2
Focus on the absolute nth node where n is read from the input buffer.
Focus on the file by name from the present working directory.
Example: FocusByFileName: README.md
Change the present working directory ($PWD)
Example: ChangeDirectory: /tmp
Enter into the currently focused path if it’s a directory.
Go back to the parent directory.
Append/buffer the given string into the input buffer.
Example: BufferInput: foo
Append/buffer the characted read from a keyboard input into the input buffer.
Set/rewrite the input buffer with the given string. When the input buffer is not-null (even if empty string) it will show in the UI.
Example: SetInputBuffer: foo
Reset the input buffer back to null. It will not show in the UI.
Switch input mode. This will reset the input buffer and call Refresh
automatically.
Example: SwitchMode: default
Call a shell command with the given arguments. Note that the arguments will be shell-escaped. So to read the variables, the -c
option of the shell can be used. You may need to pass Refresh or Explore depening on the expectation.
Example: Call: {command: bash, args: ["-c", "read -p test"]}
An alias to Call: {command: bash, args: ["-c", "${command}"]}
where ${command} is the given value.
Example: BashExec: "read -p test"
Select the focused node.
Unselect the focused node.
Toggle selection on the focused node.
Clear the selection
Add a filter to explude nodes while exploring directories.
Example: AddNodeFilter: {filter: RelativePathDoesStartWith, input: foo}
Remove an existing filter.
Example: RemoveNodeFilter: {filter: RelativePathDoesStartWith, input: foo}
Remove a filter if it exists, else, add a it.
Example: ToggleNodeFilter: {filter: RelativePathDoesStartWith, input: foo}
Add a node filter reading the input from the buffer.
Example: AddNodeFilterFromInput: {filter: RelativePathDoesStartWith}
Reset the node filters back to the default configuration.
Log information message. Stored in $XPLR_LOGS.
Example: LogInfo: launching satellite
Log a success message. Stored in $XPLR_LOGS.
Example: LogSuccess: satellite reached destination. Stored in $XPLR_LOGS
Log an error message, Stoted in $XPLR_LOGS
Example: LogError: satellite crashed
Print selected paths if it’s not empty, else, print the focused node’s path.
Print the state of application in YAML format. Helpful for debugging or generating the default configuration file.
Write the application state to a file, without quitting. Also helpful for debugging.
Terminate the application with a non-zero return code.