![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@2fd/command
Advanced tools
Modular command line interface
npm install --save @2fd/command
Lazy load.
Commands can be defined as a string that represents its location, which allows to generate complex tools without the large number of files slowing down the boot.
Commands are user-defined.
The name that invokes a command is defined by the implementation, which allows you to specify more practical commands (such as 'migration:init'or 'mgt:i' instead of 'module-name:migracions:init').
Third-party packages can only suggest the list of commands and names that implement them, but always you can implement only those you need and even replace them with your own ones.
Fully modular. A simple and completely object-oriented APIs allow easily:
Create commands that can be shared with the community
Re-implement and/or expand any functionality
Integrate commands created by third parties
Command implementation
import {
Command,
BoolanFlag,
Param
} from '@2fd/command';
// Object command implementation
class MyCommand extends Command {
description = 'My Command description';
params = new Param('requireParam [optionalParam] [...optionalParamList]');
flags = [
new BoolanFlag('force', ['--force', '-f'], 'Force flag'),
];
// action(input, output) { }; in javascript
action(input: InputInterface, output: OutputInterface): void {
// input.params.requireParam: string
// input.params.optionalParam?: string
// input.params.optionalParamList: Array<string>
// input.flags.force: boolean
};
}
export let myCommand = new MyCommand;
// Function command implementation
export function myQuickCommand(input: InputInterface, output: OutputInterface): void {
// Do something
}
Multiple command executor
// cmd.js
import {
ExecutorCommand,
ArgvInput,
ConsoleOutput
} from '@2fd/command';
import {myCommand} from './path/to/commands';
let tool = new ExecutorCommand();
tool.version = '1.0.0';
tool.description = 'Command description';
tool.addCommand('run', myCommand );
// or
tool.addCommand('run', './path/to/commands#myCommand' );
tool.addCommands({
'command1' : './path/to/commands#myCommand',
'command2' : './path/to/commands#myCommand'
});
tool.addCommadsNS('ns', {
'command3' : './path/to/commands#myCommand',
'command4' : './path/to/commands#myCommand'
});
tool.handle(
new ArgvInput(process.argv),
new ConsoleOutput()
);
> node cmd.js
Command description [v1.0.0]
Usage: node cmd.js [COMMAND]
run My Command description
command1 My Command description
command2 My Command description
ns:command3 My Command description
ns:command4 My Command description
Simple command in file
// command.js
import {myCommand} from './path/to/commands';
myCommand.handle(
new ArgvInput(process.argv),
new ConsoleOutput()
);
> node command.js --help
Usage: node command.js [OPTIONS] requireParam [optionalParam] [...optionalParamList]
My Command description
--force, -f Force flag
--help, -h Print this help
FAQs
Modular command line tool
The npm package @2fd/command receives a total of 14,484 weekly downloads. As such, @2fd/command popularity was classified as popular.
We found that @2fd/command demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.