added cls and improved ui related to word search

This commit is contained in:
Vishal 2022-11-24 19:08:34 +05:30
parent 8f7b7b03e2
commit a1014f9c1a
4 changed files with 22 additions and 10 deletions

View File

@ -1184,28 +1184,35 @@ Future<void> socialMenuUi(Store node) async {
break;
case 3:
clearScreen();
String temp = userPublicKey;
bool selectorTrees_userNotifications (Tree t) => t.treeSelectorRepliesAndLikes(temp);
node.printTree(0, DateTime.now().subtract(Duration(days:gNumLastDays)), selectorTrees_userNotifications);
break;
case 4:
clearScreen();
node.printTree(0, DateTime.now().subtract(Duration(days:gNumLastDays)), selectorTrees_selfPosts);
break;
case 5:
clearScreen();
node.printTree(0, DateTime.now().subtract(Duration(days:gNumLastDays)), selectorTrees_userRepliesLikes);
break;
case 6:
clearScreen();
node.printTree(0, DateTime.now().subtract(Duration(days:gNumLastDays)), selectorTrees_followsPosts);
break;
case 7: // search word or event id
clearScreen();
stdout.write("Enter word(s) to search: ");
String? $tempWords = stdin.readLineSync();
String words = $tempWords??"";
if( words != "") {
bool onlyWords (Tree t) => t.treeSelectorHasWords(words.toLowerCase());
node.printTree(0, DateTime.now().subtract(Duration(days:gNumLastDays)), onlyWords); // search for last gNumLastDays only
int numPrinted = node.printTree(0, DateTime.now().subtract(Duration(days:gNumLastDays)), onlyWords); // search for last gNumLastDays only
if( numPrinted == 0) {
print("Word(s) not found in last $gNumLastDays days. Try increasing the number of days printed, from social network options to search further back into history.\n");
}
} else printWarning("Blank word entered. Try again.");
break;
@ -1221,12 +1228,14 @@ Future<void> socialMenuUi(Store node) async {
break;
*/
case 8: // follow new contact
// in case the program was invoked with --pubkey, then user can't send messages
if( userPrivateKey == "") {
printWarning("Since no user private key has been supplied, posts/messages can't be sent. Invoke with --prikey");
break;
}
clearScreen();
stdout.write("Enter username or first few letters of user's public key( or full public key): ");
String? $tempUserName = stdin.readLineSync();
String userName = $tempUserName??"";
@ -1299,6 +1308,7 @@ Future<void> socialMenuUi(Store node) async {
break;
case 9: // change number of days printed
clearScreen();
stdout.write("Enter number of days for which you want to see posts: ");
String? $tempNumDays = stdin.readLineSync();
String newNumDays = $tempNumDays??"";
@ -1318,7 +1328,8 @@ Future<void> socialMenuUi(Store node) async {
break;
case 10:
stdout.write("Type username or first few letters of user's public key( or full public key): ");
clearScreen();
stdout.write("Printing profile of a user; type username or first few letters of user's public key( or full public key): ");
String? $tempUserName = stdin.readLineSync();
String userName = $tempUserName??"";
if( userName != "") {

View File

@ -3,7 +3,7 @@ import 'package:logging/logging.dart';
// name of executable
const String exename = "nostr_console";
const String version = "0.1.7-beta";
const String version = "0.1.8-beta";
int gDebug = 0;
int gSpecificDebug = 0;

View File

@ -1439,8 +1439,10 @@ class Store {
numPrinted += printTopPost(topPosts[i], depth, newerThan);
}
if( numPrinted > 0)
print("\nTotal posts printed: $numPrinted for last $gNumLastDays days");
if( numPrinted > 0) {
print("\nTotal posts printed: $numPrinted for last $gNumLastDays days\n.");
}
return numPrinted;
}

View File

@ -1,11 +1,10 @@
name: nostr_console
description: A multi-platform nostr client built for terminal/console.
version: 0.1.7-beta
version: 0.1.8-beta
homepage: https://github.com/vishalxl/nostr_console
# Release 0.1.6-beta
# update when sending kind 1
# improved url breaking
# Release 0.1.8-beta
# menu changed
environment:
sdk: '>=2.17.3 <3.0.0'