|
1 | | -# script-manager |
| 1 | +# Script Manager |
2 | 2 |
|
3 | | -A dependency manager for scripts to use in the mod CC: Tweaked of Minecraft. |
| 3 | +**SCM** is a script manager for Minecrafts ComputerCraft mod. |
4 | 4 |
|
5 | | -# Install |
6 | | -Download SCM with the following command: |
| 5 | +We are using [CC: Tweaked](https://tweaked.cc/) and in some cases some additional peripherals, which we ideally mention in the repositories of the scripts that use them. |
| 6 | + |
| 7 | +**SCM** is used so you don't have to worry too much about your libraries. You can focus on writing your program and if it uses external libraries, they will be installed automatically. Furthermore, if you want to keep your scripts up-to-date, **SCM** saves the source of the programs you've installed and lets you update them by just typing `scm update <name>`. |
| 8 | + |
| 9 | +[Documentation](https://github.com/mc-cc-scripts/script-manager/wiki) | [MIT License](https://github.com/mc-cc-scripts/script-manager/blob/master/LICENSE) |
| 10 | + |
| 11 | +# Quickstart |
| 12 | +## Installation |
| 13 | +Download **SCM** with the following command: |
7 | 14 |
|
8 | 15 | pastebin run 1kKZ8zTS |
9 | 16 |
|
10 | | -# Commands |
11 | | -**Note:** "From GitHub" usually refers to repositories within this project. "Script" refers to programs **and** libraries. |
12 | | -## add |
13 | | -- `<name>`: Downloads a program from GitHub. Programs always have the suffix `-prog` ([Naming Conventions](https://github.com/mc-cc-scripts/.github/blob/master/profile/README.md#naming-conventions)). The suffix should not be added to the name. |
14 | | -- `<name>@<pastebin code>`: Downloads a program from Pastebin. |
15 | | -## require |
16 | | -- `<name>`: Downloads a library from GitHub. Libraries always have the suffix `-lib` ([Naming Conventions](https://github.com/mc-cc-scripts/.github/blob/master/profile/README.md#naming-conventions)). The suffix should not be added to the name. |
17 | | -- `<name>@<pastebin code>`: Downloads a library from Pastebin. |
18 | | -## update |
19 | | -By default, without parameters, `update` updates the SCM script. |
20 | | -- `<name>`: Removes and downloads an installed script by name. |
21 | | -- `all`: Removes and downloads all installed scripts. |
22 | | -- `<name> <sourceName>`: Removes and downloads an installed script from a specific source. Sources can be added via the `source` command. |
23 | | -## source |
24 | | -**`source` commands have not yet been implemented.** |
25 | | -Feel free to do so [here](https://github.com/mc-cc-scripts/script-manager/issues/2). |
26 | | -- `add <scriptName> <sourceName> <source>`: Adds a source (URL, Pastebin Code, ...) with a name to a script. |
27 | | -- `get <scriptName>`: Shows all sources of a script. |
28 | | -- `remove <scriptName> <sourceName>`: Removes a source from a script. |
29 | | -- `default <scriptName> <sourceName>`: Sets a specific source to the default of a script. The previous default script gets a generated name. |
30 | | -- `rename <scriptName> <sourceName> <newSourceName>`: Updates the name of a source. |
31 | | -## remove |
32 | | -- `<name>`: Deletes a script by name. |
33 | | -- `all`: Deletes all scripts. |
34 | | -## list |
35 | | -Shows all installed scripts. |
36 | | -## config |
37 | | -Shows all available configurations. |
38 | | -- `<name>`: Shows the value of a specific configuration. |
39 | | -- `<name> <value>`: Updates the value of a specific configuration. |
40 | | -## refresh |
41 | | -Downloads the names of all programs and libraries of the official repository. |
42 | | -Refreshes autocomplete. |
43 | | -## help |
44 | | -Shows all available commands and their description. |
45 | | -- `<name>`: Shows the description of a command by name. |
| 17 | +## Configuration |
| 18 | +There are various configurations you can change. If you want to use your own repository, you can easily change it in the [configuration](https://github.com/mc-cc-scripts/script-manager/wiki/Configuration). |
| 19 | + |
| 20 | +## Commands |
| 21 | +You can find a complete list of all commands [here](https://github.com/mc-cc-scripts/script-manager/wiki/Commands). |
46 | 22 |
|
47 | | -# Example |
48 | | -## Requires |
49 | | -If you want to load a library within a program and keep it updated through SCM, then you can do that with the following notation: |
| 23 | +## Download a program |
| 24 | +You can either download a program from GitHub with |
| 25 | +``` |
| 26 | +scm add testProgram |
| 27 | +``` |
| 28 | +or from Pastebin with |
| 29 | +``` |
| 30 | +scm add testProgram@7ByR3NYn |
| 31 | +``` |
50 | 32 |
|
| 33 | +## Build scripts |
| 34 | +### Program |
| 35 | +To add libraries to your programs, you will have to require **SCM** first. |
51 | 36 | ```lua |
52 | 37 | local scm = require("./scm") |
| 38 | +``` |
| 39 | +Then you can load your libraries as follows: |
| 40 | +```lua |
53 | 41 | scm:load("testLibrary") |
54 | 42 | ``` |
| 43 | +If a library is missing, **SCM** will try to install it. |
55 | 44 |
|
56 | | -If the library is already called by a program using this SCM loader, SCM will check all libraries loaded for these comments: |
57 | | - |
58 | | - |
| 45 | +### Libraries |
| 46 | +Furthermore, **SCM** can also check nested sub-libraries within the loaded library. To do that, you will have to add a comment before requiring the library. This has the advantage of the libraries still being usable without **SCM**, as a comment does not interfer with the logic of the script. |
59 | 47 | ```lua |
60 | 48 | --@requires subLibrary |
61 | 49 | require("./libs/subLibrary") |
62 | | - |
63 | 50 | ``` |
64 | | -The comment tells SCM to look for the sub-library and, if it's not already installed, it will try to download it. |
65 | | -This prevents the program from crashing, should SCM not be installed. |
66 | | - |
67 | 51 | ### Pastebin |
68 | | - |
69 | | -If there is a "@" after the library name, it will look for the library and install it from the Pastebin-Code instead of GitHub |
| 52 | +You can also use libraries hosted on Pastebin. Just attach the Pastebin code at the end of the name, separated by an `@`. |
70 | 53 | ```lua |
71 | 54 | --@requires subLibrary@z4VRj21Y |
| 55 | +require("./libs/subLibrary") |
72 | 56 | ``` |
73 | 57 |
|
0 commit comments