Skip to content

Using devel : adding commands and packages

Max2 edited this page Oct 1, 2022 · 8 revisions

General

Commandline arguments:

  • '-' at the begining of an argument means the argument is an option and the arguent after this option is the value for it.
    e.g. devel -<key> <value> <arg> -> key & value will do someting and then be skipped.
  • '--' at the begining of an argument means the argument is an option and does not take a value.
    e.g. devel --<key> <arg>

List of key-value arguments:

This list is empty for now - there are none.

List of single arguments:

  • --nocopy : When you add a package, the source files are normally copied to src/Commands/main or src/Commands/sub. This option disables that. It is primary for building the code with an IDE and projects (e.g. Visual Studio). If you use the Makefile, it is better to not use this option, because you would have to add your source to the Makefile manually. The Makefile takes alle .c files in the in src/Commands/main and src/Commands/subautomatically.

The "true" argument(s)

  • add msh_command_<type>_<name> : Adds the command named msh_command_<type>_<name> to the msh interpreter.
  • package <filepath> : Adds a package to the msh interpreter. <filepath> must be the path to the folder of the package (without a / or \ at the end!!).

To use devel

Either type

make develop
./devel <commandline arguments>

or use devel over the Makefile (see below).

Makefile

To add a package

Download the packages repo code (or just the package you want). If the packages repo is next to the mshgit repo code on your desktop (the folders are in the same parent folder):

packages/
mshgit/

Then you don't have to change anything. Should that not be the case, you'll may have to change the includes in the files of the packages. The correct includes should already be commented above or below the activ includes.

Now got to the mshgit folder:

cd mshgit

and type

make command action=package data=<your path to the package folder>

In most cases you'll want:

make command action=package data=../packages/std-essential

Do not set the slash ("/") at the end!

To add a single command

This is similar to adding a package.
Copy your .c file to

mshgit/src/Commands/main

or

mshgit/src/Commands/sub

depending on what type your command is.
Got to the mshgit folder and type the following command:

make command action=add data=msh_command_<type>_<name of your command>

Finished :).

Visual Studio

Build the devel project (don't forget the all.o file), set the commandline arguments in in the project properties under Debug and run it. Also see Building on Windows - Using Visual Studio