| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // +build !windows |
| 6 |
| 7 // unix-specific function implementations for the firstrun subcommand. |
| 8 |
| 9 package firstrun |
| 10 |
| 11 import ( |
| 12 "errors" |
| 13 ) |
| 14 |
| 15 var executableName = "cr" |
| 16 |
| 17 // firstrunPromptInstallDir prompts the user for a directory path to install cr. |
| 18 func firstrunPromptInstallDir() (string, error) { |
| 19 return "", errors.New("firstrun_unix.firstrunPromptInstallDir not yet im
plemented") |
| 20 // TODO(agable): Figure out a sane place to suggest. |
| 21 // TODO(agable): Suggest it and ask the user for an alternative. |
| 22 // TODO(agable): Check that the chosen directory makes sense. |
| 23 } |
| 24 |
| 25 // firstrunInitInstallDir sets up the selected directory to house cr. It creates |
| 26 // the modules/ and bin/ subdirectories, places the cr executable in the |
| 27 // top level, and symlinks it into bin/. |
| 28 func firstrunInitInstallDir(dir string) error { |
| 29 return errors.New("firstrun_unix.firstrunInitInstallDir not yet implemen
ted") |
| 30 // TODO(agable): Create the cr/ directory. |
| 31 // TODO(agable): Copy this executable into the cr/ directory. |
| 32 // TODO(agable): Create the bin/ subdirectory. |
| 33 // TODO(agable): Add a symlink to the cr executable in the bin/ subdirec
tory. |
| 34 // TODO(agable): Create the modules/ subdirectory. |
| 35 } |
| 36 |
| 37 // firstrunUpdatePath finds the rcfile in which $PATH is set, sees if it can |
| 38 // automatically update it, and prompts the user for permission to do so. |
| 39 func firstrunUpdatePath(dir string) error { |
| 40 return errors.New("firstrun_unix.firstrunUpdatePath not yet implemented"
) |
| 41 // TODO(agable): Detect the user's default shell. |
| 42 // TODO(agable): Find their shell's rcfile. |
| 43 // TODO(agable): Find lines modifying $PATH in that file. |
| 44 // TODO(agable): Fine a line mentioning depot_tools. |
| 45 // TODO(agable): Produce a git-style diff adding the install bin/ dir af
ter than line. |
| 46 // TODO(agable): Prompt the user to see if they want to apply that diff. |
| 47 // TODO(agable): Apply the diff, or print instructions on how to do it m
anually. |
| 48 } |
| 49 |
| 50 // firstrunPrintUpdatePathInstructions prints instructions for the user to |
| 51 // update their $PATH manually. This is used if updatePath fails, or if the user |
| 52 // declines to have their rcfile updated automatically. |
| 53 func firstrunPrintUpdatePathInstructions() error { |
| 54 return errors.New("firstrun_unix.firstrunPrintUpdatePathInstructions not
yet implemented") |
| 55 } |
| OLD | NEW |