Skip to content

Command line interface

Luke edited this page Oct 22, 2024 · 5 revisions

Usage

The following was generated by running the command ox -h

Ox: A lightweight and flexible text editor

USAGE: ox [options] [files]

OPTIONS:
  --help, -h                   : Show this help message
  --version, -v                : Show the version number
  --config [path], -c [path]   : Specify the configuration file
  --readonly, -r               : Prevent opened files from writing
  --filetype [name], -f [name] : Set the file type of files opened
  --stdin                      : Reads file from the stdin
  --config-assist              : Activate the configuration assistant

EXAMPLES:
  ox
  ox test.txt
  ox test.txt test2.txt
  ox /home/user/docs/test.txt
  ox -c config.lua test.txt
  ox -r -c ~/.config/.oxrc -f Lua my_file.lua
  tree | ox -r --stdin
  ox --config-assist

Deeper Explanation

Files

You can open a file, or multiple files, by simply listing them after you've provided any options you want to use.

If you provide a file that doesn't exist on the disk, Ox will make a new file for you to edit, and when you save it, it will save it to the disk.

If you provide a file that does exist, it will open it.

Options

config

This option will set the configuration file (if you want to put it somewhere other than the ~/.oxrc default directory)

readonly

This option will prevent you from editing the document or saving it to disk.

This will make all files that you provide on the command line read only.

filetype

This option will force files that you open to use a certain file type.

You must provide the extension to the file type you want to use e.g. lua for lua, rs for rust, sh for a shell script, py for python

This will make all files that you provide on the command line use this file type.

stdin

With this option enabled, you'll be able to read text from the stdin.

This option allows you to pipe information into ox.

If you want to view the output of a command, for example, you can do so as such:

tree | ox --stdin

In this case, it runs the command tree and pipes the input into ox, where the --stdin option makes ox receive the input

config assist

Using this option will trigger the configuration assistant, which will allow you to re-configure Ox to your liking. At the end, there will be a warning, if you choose to write the new configuration you've created, it will move your existing configuration file to .oxrc-backup.

Clone this wiki locally