scheduler 작업중
This commit is contained in:
parent
287e88645c
commit
1f2e6c5d0a
6 changed files with 82 additions and 6 deletions
|
|
@ -1,18 +1,16 @@
|
|||
import 'package:dart_framework/utils/system_util.dart';
|
||||
import 'package:oto_cli/cli/cli.dart';
|
||||
import 'package:oto_cli/cli/commands/command_scheduler.dart';
|
||||
import 'package:oto_cli/cli/commands/command_template.dart';
|
||||
import 'package:oto_cli/cli/commands/command_install.dart';
|
||||
// import 'package:oto_cli/cli/commands/command_install.dart';
|
||||
import 'package:oto_cli/cli/commands/command_exe.dart';
|
||||
import 'package:oto_cli/cli/commands/command_start.dart';
|
||||
// import 'package:oto_cli/cli/commands/command_start.dart';
|
||||
|
||||
void main(List<String> arguments) async {
|
||||
initialize();
|
||||
CLI.initialize('OTO', arguments, [
|
||||
CommandTemplate(),
|
||||
CommandInstall(),
|
||||
CommandUninstall(),
|
||||
CommandExe(),
|
||||
CommandStart(),
|
||||
CommandStop()
|
||||
CommandScheduler()
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
40
lib/cli/commands/command_scheduler.dart
Normal file
40
lib/cli/commands/command_scheduler.dart
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:oto_cli/cli/commands/command_base.dart';
|
||||
import 'package:dart_framework/utils/system_util.dart';
|
||||
import 'package:oto_cli/cli/commands/scheduler/scheduler.dart';
|
||||
|
||||
class CommandScheduler extends CommandBase {
|
||||
|
||||
@override
|
||||
Map<String, List<String>> get arguments => {
|
||||
'-l': ["Shows the currently operational schedulers."],
|
||||
'-k {alias}': ["Shut down the active scheduler."]
|
||||
};
|
||||
@override
|
||||
String get name => 'scheduler';
|
||||
final Scheduler _scheduler = Scheduler();
|
||||
|
||||
@override
|
||||
Future execute(List<String> parameters) async {
|
||||
for (var i = 0; i < parameters.length; ++i) {
|
||||
var item = parameters[i];
|
||||
if (item.startsWith('-l')) {
|
||||
} else if (item.startsWith('-k')) {
|
||||
var alias = '';
|
||||
if (parameters.length > i + 1) {
|
||||
alias = parameters[i + 1];
|
||||
} else {
|
||||
alias = item.replaceFirst('-f', '').trimLeft();
|
||||
}
|
||||
print('======================> $alias');
|
||||
}
|
||||
}
|
||||
return simpleFuture;
|
||||
}
|
||||
|
||||
@override
|
||||
String getDescription() {
|
||||
return ':::: Run as a service on the background.';
|
||||
}
|
||||
}
|
||||
20
lib/cli/commands/scheduler/scheduler.dart
Normal file
20
lib/cli/commands/scheduler/scheduler.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:oto_cli/cli/commands/scheduler/scheduler_linux.dart';
|
||||
import 'package:oto_cli/cli/commands/scheduler/scheduler_osx.dart';
|
||||
import 'package:oto_cli/cli/commands/scheduler/scheduler_windows.dart';
|
||||
|
||||
abstract class Scheduler {
|
||||
factory Scheduler() {
|
||||
if(Platform.isMacOS) {
|
||||
return SchedulerOsx();
|
||||
} else if(Platform.isWindows) {
|
||||
return SchedulerWindows();
|
||||
} else if(Platform.isLinux) {
|
||||
return SchedulerLinux();
|
||||
} else {
|
||||
throw UnsupportedError('This platform not supported.');
|
||||
}
|
||||
}
|
||||
}
|
||||
6
lib/cli/commands/scheduler/scheduler_linux.dart
Normal file
6
lib/cli/commands/scheduler/scheduler_linux.dart
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
import 'package:oto_cli/cli/commands/scheduler/scheduler.dart';
|
||||
|
||||
class SchedulerLinux implements Scheduler {
|
||||
|
||||
}
|
||||
6
lib/cli/commands/scheduler/scheduler_osx.dart
Normal file
6
lib/cli/commands/scheduler/scheduler_osx.dart
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
import 'package:oto_cli/cli/commands/scheduler/scheduler.dart';
|
||||
|
||||
class SchedulerOsx implements Scheduler {
|
||||
|
||||
}
|
||||
6
lib/cli/commands/scheduler/scheduler_windows.dart
Normal file
6
lib/cli/commands/scheduler/scheduler_windows.dart
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
import 'package:oto_cli/cli/commands/scheduler/scheduler.dart';
|
||||
|
||||
class SchedulerWindows implements Scheduler {
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue