feat: enable starting text share via command line (#2661)

This commit is contained in:
Guilherme Nandi Tiscoski
2025-10-26 20:59:23 -05:00
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;
}