mirror of
https://github.com/localsend/localsend.git
synced 2026-06-23 04:10:07 +00:00
feat: enable starting text share via command line (#2661)
This commit is contained in:
committed by
GitHub
parent
98cc7488e6
commit
574a54acdb
@@ -291,11 +291,16 @@ class LoadSelectionFromArgsAction extends AsyncReduxActionWithResult<SelectedSen
|
||||
Future<(List<CrossFile>, bool)> reduce() async {
|
||||
bool filesAdded = false;
|
||||
bool nextShare = false;
|
||||
bool nextText = false;
|
||||
for (final arg in args) {
|
||||
if (arg == '--share') {
|
||||
nextShare = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == '--text' || arg == '-t') {
|
||||
nextText = true;
|
||||
continue;
|
||||
}
|
||||
if (nextShare) {
|
||||
nextShare = false;
|
||||
final json = jsonDecode(arg);
|
||||
@@ -313,6 +318,14 @@ class LoadSelectionFromArgsAction extends AsyncReduxActionWithResult<SelectedSen
|
||||
filesAdded = true;
|
||||
continue;
|
||||
}
|
||||
if (nextText) {
|
||||
nextText = false;
|
||||
if (arg.trim().isNotEmpty) {
|
||||
dispatch(AddMessageAction(message: arg.trim()));
|
||||
filesAdded = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (arg.startsWith('-')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user