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_head into a command line.
5.. versionadded:: 1.5
6"""
7from __future__ import print_function
8import os
9import sys
10from pyquickhelper.cli.cli_helper import call_cli_function
13def file_head_cli(fLOG=print, args=None):
14 """
15 Takes the first lines from a file using function @see fn file_head.
17 :param fLOG: logging function
18 :param args: to overwrite ``sys.args``
20 .. cmdref::
21 :title: extract the first lines of a file
22 :cmd: pyensae.cli.head_cli:file_head_cli
24 Extracts the first line of a file.
25 """
26 try:
27 from pyensae.filehelper.content_helper import file_head
28 except ImportError:
29 folder = os.path.normpath(os.path.join(
30 os.path.abspath(os.path.dirname(__file__)), "..", ".."))
31 sys.path.append(folder)
32 from pyensae.filehelper.content_helper import file_head
34 call_cli_function(file_head, args=args, fLOG=fLOG,
35 skip_parameters=('fLOG',))
38if __name__ == "__main__":
39 file_head_cli()