source: expand_date@ 9b90ecc

xry111/git-date
Last change on this file since 9b90ecc was 9b90ecc, checked in by Xi Ruoyao <xry111@…>, 5 months ago

fix date format for $Date$

  • Property mode set to 100755
File size: 330 bytes
Line 
1#!/usr/bin/env python3
2
3from os import getcwd
4from subprocess import check_output
5from sys import stdin, stdout, argv
6
7content = stdin.read()
8cmd = [ 'git', 'log', '-1', '--pretty=%ai', 'HEAD', '--', argv[1] ]
9date = check_output(cmd, cwd = getcwd()).decode().rstrip()
10stdout.write(content.replace('$Date$', '$Date: %s$' % date))
Note: See TracBrowser for help on using the repository browser.