Init command

Init is the first implemented command which goal is to initialize package file (deplink.json) with filled in required fields (currently the package name and type). Package name can be directly given as a command argument, but the type is always set to “project” (also available is the “library” type) - in future it will be also configurable. Of course we can omit package name and then command will set package name depending on the directory structure, eq. if we run init command in the “/home/wojtek/hello-world” then the package name will be set to “wojtek/hello-world”.

Implementation uses the popular Symfony Console Component which is used in such project like Laravel Artisan or Composer… ok, at the beggining I should say that project will be written in the PHP language. Why I choose the PHP instead of the other languages? The answer is simple for me, I suppose that the dependencies manager for C/C++ should be implemented in the C or C++. Of course writing cross-platform projects in this language isn’t currently as simple as I expect to be so I choose other language. I could write in Python, Node.js or other scripting language, but I’m experienced in the PHP so it’s a good choice for quick start. In far future away project can be rewritten in C++ (which will be a good moment to eliminate crucial architecture mistakes not covered in the planning step).

Usage

The init command usage schema is very simple:

deplink init [options] [<package-name>]

There’s one available option (which will be also available in all commands) - the —-working-dir option (accessible also as a-d shortcut). It requires the value specifying a working directory used by the command (by default current working directory).

Example: deplink init -d ./subfolder deplink/hello-world