code: func remoteConsole(ctx *cli.Context) error {
  	// Attach to a remotely running geth instance and start the JavaScript console
  	endpoint := ctx.Args().First()
  	if endpoint == "" {
  		path := node.DefaultDataDir()
  		if ctx.GlobalIsSet(utils.DataDirFlag.Name) {
  			path = ctx.GlobalString(utils.DataDirFlag.Name)
  		}
  		if path != "" {
  			if ctx.GlobalBool(utils.TestnetFlag.Name) {
  				path = filepath.Join(path, "testnet")
  			} else if ctx.GlobalBool(utils.RinkebyFlag.Name) {
  				path = filepath.Join(path, "rinkeby")
  			}
  		}
  		endpoint = fmt.Sprintf("%s/geth.ipc", path)
  	}
  	client, err := dialRPC(endpoint)
  	if err != nil {
  		utils.Fatalf("Unable to attach to remote geth: %v", err)
  	}
  	config := console.Config{
  		DataDir: utils.MakeDataDir(ctx),
  		DocRoot: ctx.GlobalString(utils.JSpathFlag.Name),
  		Client:  client,
  		Preload: utils.MakeConsolePreloads(ctx),
  	}
  
  	console, err := console.New(config)
  	if err != nil {
  		utils.Fatalf("Failed to start the JavaScript console: %v", err)
  	}
  	defer console.Stop(false)
  
  	if script := ctx.GlobalString(utils.ExecFlag.Name); script != "" {
  		console.Evaluate(script)
  		return nil
  	}
  
  	// Otherwise print the welcome screen and enter interactive mode
  	console.Welcome()
  	console.Interactive()
  
  	return nil
  }
docs: // remoteConsole will connect to a remote geth instance, attaching a JavaScript
  // console to it.