你如何在vim的Fugitive中git add .
?
命令:Git add .
没有添加任何内容
答案 0 :(得分:4)
我认为您正在寻找import re
import subprocess
import cv2
import os
device_re = re.compile("Bus\s+(?P<bus>\d+)\s+Device\s+(?P<device>\d+).+ID\s(?P<id>\w+:\w+)\s(?P<tag>.+)$", re.I)
df = subprocess.check_output("lsusb", shell=True)
for i in df.split('\n'):
if i:
info = device_re.match(i)
if info:
dinfo = info.groupdict()
if "Logitech, Inc. Webcam C270" in dinfo['tag']:
print "Camera found."
bus = dinfo['bus']
device = dinfo['device']
break
device_index = None
for file in os.listdir("/sys/class/video4linux"):
real_file = os.path.realpath("/sys/class/video4linux/" + file)
print real_file
print "/" + str(bus[-1]) + "-" + str(device[-1]) + "/"
if "/" + str(bus[-1]) + "-" + str(device[-1]) + "/" in real_file:
device_index = real_file[-1]
print "Hurray, device index is " + str(device_index)
camera = cv2.VideoCapture(int(device_index))
while True:
(grabbed, frame) = camera.read() # Grab the first frame
cv2.imshow("Camera", frame)
key = cv2.waitKey(1) & 0xFF
。
视频here解释了逃犯以及该命令的作用非常好。
答案 1 :(得分:2)
我不知道为什么Git add .
不起作用,但您可以使用--
从路径中分隔Git add
,因此Git add -- .
可以胜任。{ / p>