Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2@file 

3@brief Wrapper function @see fn file_tail into a command line. 

4 

5.. versionadded:: 1.5 

6""" 

7from __future__ import print_function 

8import os 

9import sys 

10from pyquickhelper.cli.cli_helper import call_cli_function 

11 

12 

13def file_tail_cli(fLOG=print, args=None): 

14 """ 

15 Takes the last lines from a file using function 

16 @see fn file_tail. 

17 

18 :param fLOG: logging function 

19 :param args: to overwrite ``sys.args`` 

20 

21 .. cmdref:: 

22 :title: extract the last lines of a file 

23 :cmd: pyensae.cli.tail_cli:file_tail_cli 

24 

25 Extracts the first line of a file. 

26 """ 

27 try: 

28 from pyensae.filehelper.content_helper import file_tail 

29 except ImportError: 

30 folder = os.path.normpath(os.path.join( 

31 os.path.abspath(os.path.dirname(__file__)), "..", "..")) 

32 sys.path.append(folder) 

33 from pyensae.filehelper.content_helper import file_tail 

34 

35 call_cli_function(file_tail, args=args, fLOG=fLOG, 

36 skip_parameters=('fLOG',)) 

37 

38 

39if __name__ == "__main__": 

40 file_tail_cli()