Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python3 | |
|
Nico
2017/03/02 15:47:11
since this is only 40 lines, can you rewrite this
| |
| 2 # | |
| 3 # Copyright 2017 The Chromium Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 ''' | |
| 8 This is a wrapper script to start your editor. You also need to add this script | |
| 9 to your path. | |
| 10 ''' | |
| 11 | |
| 12 import argparse | |
| 13 import os | |
| 14 import sh | |
| 15 | |
| 16 def qtcreator_open_file(filepath, line=1): | |
| 17 sh.qtcreator("-client", filepath + ":" + str(line)) | |
| 18 | |
| 19 CHROMIUM_ROOT = os.environ['HOME'] + "/workspace/chromium/src" | |
| 20 | |
| 21 os.chdir(CHROMIUM_ROOT) | |
| 22 | |
| 23 ###### Dont change this part. BEGIN ##### | |
| 24 parser = argparse.ArgumentParser() | |
| 25 parser.add_argument("-f", "--filepath", help="Filepath.") | |
| 26 parser.add_argument("-l", "--line", type=int, help="Line number.") | |
| 27 parser.add_argument("-m", "--multifilepath", help="Multi Filepath.") | |
| 28 args = parser.parse_args() | |
| 29 ###### Dont change this part. END ##### | |
| 30 | |
| 31 # I dont have a good idea to start a QtCreator instance, so please open it | |
| 32 # manually | |
| 33 | |
| 34 # Open one file with line number | |
| 35 if args.filepath != None: | |
| 36 qtcreator_open_file(args.filepath, args.line) | |
| 37 # Open multi files | |
| 38 else: | |
| 39 for filepath in args.multifilepath.split(","): | |
| 40 qtcreator_open_file(filepath) | |
| OLD | NEW |