Skip to content

Commit acbf0c4

Browse files
committed
Support --line-start --line-end
1 parent 9c5cf5d commit acbf0c4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sphinxnotes/snippet/cli.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def main(argv:List[str]=sys.argv[1:]) -> int:
7575
help='get information of snippet by index ID')
7676
getparser.add_argument('--file', '-f', action='store_true',
7777
help='get source file path of snippet')
78+
getparser.add_argument('--line-start', action='store_true',
79+
help='get line number where snippet starts in source file')
80+
getparser.add_argument('--line-end', action='store_true',
81+
help='get line number where snippet ends in source file')
7882
getparser.add_argument('--text', '-t', action='store_true',
7983
help='get source reStructuredText of snippet')
8084
getparser.add_argument('--url', '-u', action='store_true',
@@ -159,6 +163,10 @@ def _on_command_get(args:argparse.Namespace):
159163
if item.snippet.refid():
160164
url += '#' + item.snippet.refid()
161165
print(url)
166+
if args.line_start:
167+
print(item.snippet.scope()[0])
168+
if args.line_end:
169+
print(item.snippet.scope()[1])
162170

163171

164172
def _on_command_integration(args:argparse.Namespace):

0 commit comments

Comments
 (0)