0.2.47 • Published 8 years ago

mold-js v0.2.47

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

#Mold.Core.CLI (alpha) This repository includes the moldjs command line interface and a bunch of commands. Including all commands are needed to manage mold packages.

##requirements You need nodejs and npm to install the mold clis.

##installation To install the mold cli use npm and install it global:

	npm install mold-js -g

##use mold cli After installation you can use the command mold on the command line. For example if you will create a new project/package you can do it with:

	mold init

if you want to add a package to your current project use:

	mold install -path http://path-to-your-mold-package

Use --help to get info about a command.

##commands Currently implemented (most important) commands are:

  • init - intitalise a new mold app/package creates a mold.json file

  • install - installs a mold package into the current package possible arguments are: -path - path to the package you wish to install -name - namen of the package you wish to install (currently not implemented cause registry is missing) --without-sub-packages - if set dependent packages will be ignored --without-git-ignore - if set package dependecies will not added to the git ignore file --without-npm - skips installing npm packages --without-sources - ingore all sources, only seeds(mold modules) will be copied * --without-adding-dependencies - if set dependent packages will not added to the mold.json file

  • unistall - uninstalls a package by path or name -path - the path of the package you wish to uninstall -name - name of the package
  • update - updates all or a specific package, if no argument is given all packages will be updated -path - if set the package with this path will be updated -name - if name is set only the package with this name will be updated * --force - updates the packages even if the version has not changed
  • version - get/set the version number of your package, if no parameter is set the current version will be displayed --up - set the version to the next possible number, 0.0.1 becomes 0.0.2 -set - set the version to a specific number.
  • test - executes a test for a specific seed (if a test is defined) * -name - the seed name
  • update-mold-json updates the mold.json file -property - the property to update -value - the value

##using commands programmatically To use a command in your application import { Command : "Mold.Core.Command"} in your seed. Now you can execute all commands using Command.myCommandName( options ). The command name will be translated to camelcase. Command arguments can be set via a option object. All commands will return a promise.

Example:

Command
	.install({ '-path' : 'https://raw.githubusercontent.com/jailkey/MoldJS/master/'})
	.then(function(){
		//do something if the package is successfully installed
	))
	.catch(function(err){
		//something went wrong
	})
	

##create your own command If you wish to create you own command, add a directory called CMD to your Mold repository and create a seed inside. For example Mold/CMD/MyCommand.js . When the mold cli is called, this directory will be scanned and all seeds in it will be loaded. The seed content should look like this:

	Seed({
			type : 'module',
			include : [
				{ Command : 'Mold.Core.Command' },
				{ Promise : 'Mold.Core.Promise' },
				{ Helper : 'Mold.Core.CLIHelper' }
			]
		},
		function(){
			Command.register({
				name : 'my-command',
				description : 'description of the command, it will be shown in the command help',
				parameter : {
					'--switch' : {
						'description' : 'description of the switch',
					},
					'-argument' : {
						'description' : 'description of your argument',
						'required' : true
					}
				},
				code : function(args){
					return new Promise(function(resolve, reject){
						var valueOfTheArgument = args.parameter['-argument'].value;
						
						if(args.parameter['--switch']){
							//do something
						}
						
						
						//resolve with args if command is successfull
						Helper.ok("Everything works fine!");
						resolve(args);
						
					})
				}
			})
		}
	)

This are the important parts for registering a command. Don't forget to return a promise in the command code.

Realted seeds are: Mold.Core.CLIHelper - Helps you to manage the cli output, input, colors, errors etc. Mold.Core.CLIForm - Create easily a cli form to manage user input Mold.Core.CLILoadingBar

For detailed information see api docs (when they are ready :) )

0.2.47

8 years ago

0.2.46

8 years ago

0.2.45

8 years ago

0.2.44

8 years ago

0.2.43

8 years ago

0.2.42

8 years ago

0.2.41

8 years ago

0.2.40

8 years ago

0.2.39

8 years ago

0.2.38

8 years ago

0.2.37

8 years ago

0.2.36

8 years ago

0.2.35

8 years ago

0.2.34

8 years ago

0.2.33

8 years ago

0.2.32

8 years ago

0.2.31

8 years ago

0.2.30

8 years ago

0.2.29

8 years ago

0.2.28

8 years ago

0.2.27

8 years ago

0.2.26

8 years ago

0.2.25

8 years ago

0.2.24

8 years ago

0.2.23

8 years ago

0.2.22

8 years ago

0.2.21

8 years ago

0.2.20

8 years ago

0.2.19

8 years ago

0.2.18

8 years ago

0.2.17

8 years ago

0.2.16

8 years ago

0.2.15

8 years ago

0.2.14

8 years ago

0.2.13

8 years ago

0.2.12

8 years ago

0.2.11

8 years ago

0.2.10

8 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.0.34

9 years ago

0.0.33

9 years ago

0.0.32

9 years ago

0.0.31

9 years ago

0.0.30

9 years ago

0.0.29

9 years ago

0.0.28

9 years ago

0.0.27

9 years ago

0.0.26

9 years ago

0.0.25

9 years ago

0.0.24

9 years ago

0.0.23

9 years ago

0.0.22

9 years ago

0.0.21

9 years ago

0.0.20

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago