add 'wormhole send --text -' to read message from stdin
This commit is contained in:
		
							parent
							
								
									b83062701d
								
							
						
					
					
						commit
						ec51adb713
					
				
							
								
								
									
										1
									
								
								NEWS.md
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								NEWS.md
									
									
									
									
									
								
							|  | @ -7,6 +7,7 @@ User-visible changes in "magic-wormhole": | ||||||
|   current (0.5.0) server, instead of an ugly stack trace. Unfortunately 0.4.0 |   current (0.5.0) server, instead of an ugly stack trace. Unfortunately 0.4.0 | ||||||
|   receivers still display the traceback, since they don't check the welcome |   receivers still display the traceback, since they don't check the welcome | ||||||
|   message before using a missing API. |   message before using a missing API. | ||||||
|  | * Fix `wormhole send --text -` to read the text message from stdin. | ||||||
| 
 | 
 | ||||||
| ## Release 0.5.0 (07-Oct-2015) | ## Release 0.5.0 (07-Oct-2015) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -13,6 +13,9 @@ def send(args): | ||||||
|     assert isinstance(args.relay_url, type(u"")) |     assert isinstance(args.relay_url, type(u"")) | ||||||
| 
 | 
 | ||||||
|     text = args.text |     text = args.text | ||||||
|  |     if text == "-": | ||||||
|  |         print("Reading text message from stdin..") | ||||||
|  |         text = sys.stdin.read() | ||||||
|     if not text and not args.what: |     if not text and not args.what: | ||||||
|         text = six.moves.input("Text to send: ") |         text = six.moves.input("Text to send: ") | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -68,7 +68,7 @@ p = subparsers.add_parser("send", | ||||||
|                           description="Send text message or file", |                           description="Send text message or file", | ||||||
|                           usage="wormhole send [FILENAME]") |                           usage="wormhole send [FILENAME]") | ||||||
| p.add_argument("--text", metavar="MESSAGE", | p.add_argument("--text", metavar="MESSAGE", | ||||||
|                help="text message to send, instead of a file") |                help="text message to send, instead of a file. Use '-' to read from stdin.") | ||||||
| p.add_argument("--code", metavar="CODE", help="human-generated code phrase", | p.add_argument("--code", metavar="CODE", help="human-generated code phrase", | ||||||
|                type=type(u"")) |                type=type(u"")) | ||||||
| p.add_argument("-0", dest="zeromode", action="store_true", | p.add_argument("-0", dest="zeromode", action="store_true", | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user