• Stars
    star
    236
  • Rank 170,480 (Top 4 %)
  • Language
    Dart
  • Created about 5 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An extensive library and tooling for building console/cli applications and scripts using the Dart programming language.

pub package Pub Version (including pre-releases) pub publisher Pub Likes Pub Popularity Pub Points

README

See the online documentation for DCli

DCli is an API and tooling for building cross platform command line (CLI) applications and scripts using the Dart programming language.

DCli - pronounced d-cli

Overview

DCli is intended to to allow you to create Command Line (CLI) Applications from simple scripts to full blown CLI apps.

DCli is a great replacement for CLI apps that would have traditionally been built with Bash, C, python, ruby, Go, Rust ....

Whether its a 5 line Bash script or a 100,000 line production management system (like we run internally) DCli is the right place to start building your CLI infrastructure.

So why DCli?

DCli is based on Dart which is a modern programming language that has a set of features that makes building CLI apps easy and reliable.

  • Dart and DCli are simple to learn
  • Compiled or JIT
  • Shebang support (run .dart scripts directly from the cli ./hello.dart)
  • Small transportable execs (from 10MB), Dart VM is NOT required on target system.
  • Typesafe language catches errors at compile time
  • Sound null safety reduces null pointer exceptions
  • Fast
  • Great development environment using vs-code
  • Local and Remote development/debugging
  • Cross platform supporting Linux/Windows/osx/arm

Sponsored by OnePub

Help support DCli by supporting OnePub, the private dart repository. OnePub allows you to privately share dart packages between your own projects or with colleagues. Try it for free and publish your first private package in seconds.

https://onepub.dev

Publish a private package in six commands:

dart pub global activate onepub
onepub login
dcli create --template=full myclipackage
cd myclipackage
onepub pub private
dart pub publish

You can now activate your dcli script from any system with dart installed

dart pub global activate onepub
onepub login
onepub pub global activate myclipackage

Example:

#! /usr/bin/env dcli

import 'dart:io';
import 'package:dcli/dcli.dart';

void main() {
  var name = ask('name:', required: true, validator: Ask.alpha);
  print('Hello $name');

}

To run the above script called hello.dart:

./hello.dart

So why is DCli different?

DCli is based on the relatively new programming language; Dart.

Dart is currently the fastest growing language on github and is the basis on which Flutter is built.

Ubuntu has just announced that Flutter will be the primary platform for building GUI's on Ubuntu and is currently working on replacing the Ubuntu installer using Flutter.

You can now use Dart to build GUI's on Android, IOS, Windows, OSX, Linux and the Web, server side applications and with DCli you can also target console apps.

Imagine the benefits of using a single language across you complete ecosystem.

Dart is a simple to learn, and uses the all too familiar 'C' style syntax. I've heard Dart described as the love child of Java and JavaScript. If you come from either of these environments you will find Dart easy to work with.

Being easy to learn also helps with the maintenance cycle of you CLI apps. You no longer need a specialised developer, as anyone that has even a vague familiarity with Java, Javascript or C, ... will be right at home with Dart in a couple of days.

Dart and DCli are easy to install; DCli makes it a breeze to create simple scripts and provides the tools to manage a script that started out as 100 lines but somehow grew to 10,000 lines.

Dart has is also a large and growing ecosystem of third party libraries that you can include in your CLI app with no more than an import statement and a dependency declaration.

Dart is fast and if you need even more speed it can be compiled to a single file executable that is portable between binary compatible machines.

# compile, install to the local PATH and run hello.dart

$> dcli compile --install hello.dart
$> hello
name: brett
Hello brett


# copy to a remote machine (where dart is NOT installed)
$> scp hello remote.domain.com:

# login to remote machine and run the app hello
$> ssh remote.domain.com
./hello
name: brett
Hello brett

You can use your favourite editor to create DCli scripts. Vi or VIM work fine but Visual Studio Code is recommended.

Use Visual Studio Code for the best development experience with Dart.

Visual Studio Code with the dart-code extension provide a great development an debugging experience including the ability to develop and debug code on a remote server.

Contributing

Read the contributing guide for details on how to get involved.

More Repositories

1

fsm2

FMS2 provides Dart implementation of the core design aspects of the UML state diagrams.
Dart
51
star
2

pub_release

Pub Release is a package to assist in publishing dart/flutter packages to pub.dev.
Dart
17
star
3

dcli_scripts

A range of sample and useful cli scripts written dart using the dshell library.
Dart
16
star
4

dart_posix

Dart
12
star
5

nginx-le

Nginx with Lets Encrypt management and auto renewal without downtime.
Dart
11
star
6

onepub

Cli tooling and support for OnePub the private package repository for Dart and Flutter
Dart
11
star
7

dswitch

A cli tool to rapidly switch between versions of dart.
Dart
8
star
8

simple_mysql_orm

Dart
8
star
9

fixed

A dart implementation of fixed precision numbers.
Dart
8
star
10

unpubd

A docker container and management tools for running a unpub dart respository
Dart
7
star
11

fsm2_viewer

Desktop application viewer for the fsm2 library.
Dart
4
star
12

settings_yaml

Dart
4
star
13

docker2

Simple library for viewing and controlling docker images and containers.
Dart
4
star
14

thedartside

A blog about using Dart on the backend.
4
star
15

dvault

Utility class to encrypt/decrypt files or directory trees using rsa keys and a pass phrase protected private key.
Dart
3
star
16

stacktrace_impl

A Dart library that allows you to instantiate a stack trace.
Dart
2
star
17

cli_tools_for_dart

Small collection of cli tools for management dart projects
Dart
2
star
18

dcli_core

core asynchronous code from dcli.
Dart
2
star
19

critical_test

Critical Test is a cli tool designed to simplify the process of fixing broken unit tests in Dart.
Dart
2
star
20

completer_ex

Provides logging for Dart 'Completer' when the future doesn't complete in a reasonable amount of time.
Dart
2
star
21

token_store

api for the dart pub token store
Dart
1
star
22

drtimport

An cli app to help you refactor you dart libraries because VSCode won't.
Dart
1
star
23

dotfiles

Provides a simple mechanism for tracking all of your linux configuration files like ~/.bashrc with git.
Dart
1
star
24

batman

A file integrity monitor designed to meet PCI compliance requirements.
Dart
1
star
25

tree_iterator

A dart package that provides simple interfaces for tree iteration.
Dart
1
star
26

halfpipe

Dart
1
star
27

fido-server

Demonstration fido server.
Dart
1
star
28

future_builder_ex

An improved version of FlutterBuilder
Dart
1
star