Introduce a very rough skeleton to implement interactive shell
This commit is contained in:
		
							parent
							
								
									ad252c7480
								
							
						
					
					
						commit
						b471f6a914
					
				
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							@ -39,10 +39,6 @@ func parseArguments() {
 | 
				
			|||||||
	settings["usePager"] = strconv.FormatBool(*usePagerPtr)
 | 
						settings["usePager"] = strconv.FormatBool(*usePagerPtr)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func interactiveShell() {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func showQueue() {
 | 
					func showQueue() {
 | 
				
			||||||
	queue, err := fetchQueue()
 | 
						queue, err := fetchQueue()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										34
									
								
								shell.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								shell.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"bufio"
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
 | 
						"os"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func interactiveShell() {
 | 
				
			||||||
 | 
						fmt.Println("Let's try an interactive shell!")
 | 
				
			||||||
 | 
						scanner := bufio.NewScanner(os.Stdin)
 | 
				
			||||||
 | 
						for {
 | 
				
			||||||
 | 
							fmt.Print("> ")
 | 
				
			||||||
 | 
							if !scanner.Scan() {
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							text := strings.Trim(scanner.Text(), " ")
 | 
				
			||||||
 | 
							textFields := strings.Fields(text)
 | 
				
			||||||
 | 
							if len(textFields) == 0 {
 | 
				
			||||||
 | 
								continue
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							cmd := textFields[0]
 | 
				
			||||||
 | 
							fmt.Printf("Read input: %q\n", textFields)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							switch cmd {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
								fmt.Printf("Unknown command '%s'\n", cmd)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						fmt.Println("\nGoodbye!\n")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user