What does DCli do?
Last updated
Was this helpful?
Was this helpful?
import 'package:dcli/dcli.dart';
void main(){
var username = ask('Username:', validator: Ask.required);
if (confirm('Are you over 18')) {
print(orange('Welcome to the club'));
}
var selected = menu('Select your poison', options: ['beer', 'wine', 'spirits']
defaultOption: 'beer');
print(green('You choice was: $selected'));
}print(orange("I'm an important message"));
printerr(red('Oops, something went wrong here'));import 'package:dcli/dcli.dart';
void main() {
if (!exists('/keep')) {
createDir('/keep');
}
var images = find('*.png', root: '/images');
for (var image in images) {
if (image.startsWith('nsfw')) {
copy(image, '/keep');
}
}
}// write lines to myfile.ini
var settings = 'myfile.ini';
settings.write('[section1]');
settings.append('color=red');
settings.append('color=blue');
// fix the spelling in myfile.ini
replace(settings, 'color', 'colour');var user = ask('username');
var password = ask('password', hidden:true);
'mysql -u $user --password=$password customerdb -e "select 1"'.run;var users = 'mysql customerdb -e "select fname, sname from user"'
.toList(skipLines: 1);
/// now parse each user and print their name
for (var user in users) {
var parts = user.split(',');
print('Firstname: ${parts[0]} Surname: ${parts[1]});
}
/// Run grep and print each line that it finds
'grep error /var/lib/syslog'.forEach((line) => print(line));var user = env['USER'];
env['JAVA_HOME'] = '/usr/lib/java';Env().appendToPath('/home/me/bin');
Env().addToPATHIfAbsent('/home/me/bin');
Env().removeFromPATH('/home/me/bin');/// Get details of the current dart script that is running.
DartScript.current;
DartSdk().pathToDartExe;
PubCache().pathTo