bash/slrn: add netrc usage

This commit is contained in:
Paul Walker
2021-02-11 11:09:58 +00:00
parent 7e567144bc
commit eaf22f4e85
4 changed files with 30 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
alias serv="cd ~/src/servicesmart" alias serv="cd ~/src/servicesmart"
addpath /Users/paul/Library/Python/3.7/bin addpath /Users/paul/Library/Python/3.7/bin
addpath ~/.npm-global/bin addpath ~/.npm-global/bin
`netrc news.xcski.com NNTP`

View File

@@ -23,3 +23,5 @@ addpath $ANDROID_HOME/platform-tools
export TERM=xterm-256color export TERM=xterm-256color
alias k="khal interactive" alias k="khal interactive"
`netrc news.xcski.com NNTP`

21
bin/netrc Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env python3
import sys
from netrc import netrc
if len(sys.argv) < 2:
print("Usage: netrc machine [env_prefix]")
sys.exit(1)
prefix=""
machine = sys.argv[1]
if len(sys.argv) > 2: prefix = sys.argv[2]
n = netrc()
if machine in n.hosts.keys():
entry = n.hosts[machine]
print("export %sUSER=%s" % (prefix, entry[0]))
print("export %sPASS=%s" % (prefix, entry[2]))
else:
print("echo %s not found in .netrc" % machine)
sys.exit(2)

9
slrnrc
View File

@@ -16,6 +16,7 @@
%nnrpaccess "HOSTNAME" "USERNAME" "" % Prompt for password %nnrpaccess "HOSTNAME" "USERNAME" "" % Prompt for password
%nnrpaccess "HOSTNAME" "" "" % Prompt for username and password %nnrpaccess "HOSTNAME" "" "" % Prompt for username and password
%nnrpaccess news.xcski.com blacksun2 vD82QRK6
set hostname "blacksun.org.uk" set hostname "blacksun.org.uk"
set username "paul" set username "paul"
@@ -187,8 +188,8 @@ set abort_unmodified_edits 1
% Command used to invoke editor. In the following example, %s represents % Command used to invoke editor. In the following example, %s represents
% the file name and %d represents the starting line number % the file name and %d represents the starting line number
%set editor_command "jed '%s' -g %d -tmp" %set editor_command "jed '%s' -g %d -tmp"
%set editor_command "joe '%s'" set editor_command "joe '%s'"
set editor_command "~/.edit.sh '%s'" %set editor_command "~/.edit.sh '%s'"
% Editor command for editing posts, mail, and score files. Note the use of % Editor command for editing posts, mail, and score files. Note the use of
% single quotes around %s. This is only necessary if you use filenames % single quotes around %s. This is only necessary if you use filenames
@@ -307,7 +308,7 @@ set spoiler_display_mode 2
%almost redundant, whereas with others which don't expire entries from %almost redundant, whereas with others which don't expire entries from
%overview files regularly, it's almost vital. If the users sees a lot of %overview files regularly, it's almost vital. If the users sees a lot of
%"article not available" errors, they should probably try turning it on. %"article not available" errors, they should probably try turning it on.
set spool_check_up_on_nov 0 % set spool_check_up_on_nov 0
%--------------------------------------------------------------------------- %---------------------------------------------------------------------------
% GroupLens Support % GroupLens Support
@@ -520,4 +521,4 @@ setkey readline trim "\e/" % Trim whitespace
setkey readline quoted_insert "^Q" % Quoted insert setkey readline quoted_insert "^Q" % Quoted insert
%interpret /usr/local/share/slrn/search.sl %interpret /usr/local/share/slrn/search.sl
interpret /home/paul/.slrn/approved.sl %interpret /home/paul/.slrn/approved.sl