diff --git a/scripts/patrix b/scripts/patrix index 7fc2e91..f49091a 100644 --- a/scripts/patrix +++ b/scripts/patrix @@ -12,6 +12,7 @@ use File::MimeInfo; use File::Basename; use URI::Escape; use Path::Tiny; +use Term::ReadKey; our $opt; @@ -53,6 +54,16 @@ $opt->{server} //= 'matrix.org'; $opt->{action} //= 'send-msg'; $opt->{federation} //= 1; +# Prompt to enter the password +if (!$opt->{access_token} && $opt->{user} && !$opt->{password}){ + ReadMode('noecho'); + print "Password: "; + $opt->{password} = ReadLine(0); + $opt->{password} =~ s/\R\z//; + ReadMode('restore'); + print "\n"; +} + # Check we have all the options we need if ($opt->{action} eq 'get-access-token' && (!$opt->{user} || !$opt->{password})){ die "You need to provide a valid user and password to get an access token\n\n";