Help:Using the command line: Difference between revisions

From ZeldaMods (Breath of the Wild)
Jump to navigation Jump to search
imported>Leoetlino
No edit summary
imported>Leoetlino
No edit summary
Line 50: Line 50:


[[Category:Guides]]
[[Category:Guides]]
[[Category:Guides (tools)]]

Revision as of 19:12, 16 September 2018

Many recent tools are command-line interface (CLI) based because such interfaces are usually more powerful, efficient, easier to use for batch processing, and also typically easier to develop and less buggy in comparison to GUIs. And in general, modding-related GUIs that are merely wrappers of command line utilities tend to be limited and of dubious quality.

As such, being able to use the command line is a very useful skill. This applies outside of modding too.

On Linux or macOS

You already know how to use a CLI. Congratulations!

On Windows

If you are on Windows, you have probably never used a command line in your life. Fear not; that using the CLI is hard is a stereotype. It is not true in particular for BotW-related tools, which are fairly simple to manipulate. Tools will almost always have documentation that tells you how to use them too.

Opening a command line

Right click on the Start button and select the "PowerShell" menu item or press Win+X.

A blue window will appear:

Windows PowerShell
Copyright (C) 20XX Microsoft [...]

PS C:\Users\username>

You are now ready to use the command line!

Basics

On commands

Things you type into the command line almost always look like this:

command_name  argument_1  argument_2  argument_3 ...

The first word is the command name. It is the name of the program you are going to invoke.

Anything that comes after from are arguments. They tell the program what it should do or what to operate on. For example, the copy command takes the source file as the first parameter and the destination file as the second. You would type:

copy C:/source_file C:/destination

and press Enter to run the command and copy C:/source_file to C:/destination.

On options

What about optional parameters? And what if a command takes a large amount of parameters? To avoid requiring the user to memorise the argument order when there are too many, CLI utilities typically use options.

Options are just another way to give parameters. They almost always have the following form: --optionname option_value, can usually be combined and reordered, and are usually optional.

On paths

  • Paths with space or special characters in them must be quoted. This is because the system would have no way to tell whether you're giving it another argument or whether you're referring to a path when you type a space.
  • You can drag and drop files/folders into the shell window and have the shell type the entire path automatically! Handy to avoid typing long paths.

On using Python

See Help:Setting up tools for installing Python.

  • Instructions on this wiki will often use the python3 command. Replace python3 with py -3 on Windows.
  • To install a package, use py -3 -m pip install <package name>. For example, to install eventeditor, run py -3 -m pip install eventeditor.