def run(self, paths = []):
		for item in SideBarSelection(paths).getSelectedItems():
			original = item.path()
			originalIsDirectory = item.isDirectory()
			item.path(item.dirname())
			while not os.path.exists(item.join('.git')):
				if os.path.exists(item.join('.gitignore')):
					break;
				if item.dirname() == item.path():
					break;
				item.path(item.dirname())

			if os.path.exists(item.join('.gitignore')):
				item.path(item.join('.gitignore'))
			else:
				if os.path.exists(item.join('.git')):
					item.path(item.join('.gitignore'))
					item.create()
				else:
					SideBarGit().status('Unable to found repository for "'+original.encode('utf-8')+'"')
					continue
			ignore_entry = re.sub('^/+', '', original.replace(item.dirname(), '').replace('\\', '/'))
			if originalIsDirectory:
				ignore_entry = '/'+ignore_entry
			content = item.contentUTF8().strip()+'\n'+ignore_entry
			content = content.replace('\r\n', '\n')
			content = "\n".join(uniqueList(content.split('\n')))

			item.write(content.strip())
			SideBarGit().status('Ignored file "'+ignore_entry+'" on '+item.path())
Beispiel #2
0
	def run(self, paths = []):
		items = []
		for item in SideBarSelection(paths).getSelectedItemsWithoutChildItems():
			items.append(SideBarProject().getDirectoryFromPath(item.path()))
		items = uniqueList(items)
		if items:
			self.window.run_command('hide_panel');
			self.window.run_command("show_panel", {"panel": "find_in_files", "where":",".join(items)})
Beispiel #3
0
	def run(self, paths = []):
		items = []
		for item in SideBarSelection(paths).getSelectedItems():
			items.append('*'+item.extension())
		items = uniqueList(items)
		self.window.run_command('hide_panel');
		if int(sublime.version()) >= 2134:
			self.window.run_command("show_panel", {"panel": "find_in_files", "where":",".join(items) })
		else:
			self.window.run_command("show_panel", {"panel": "find_in_files", "location":",".join(items) })
Beispiel #4
0
	def description(self, paths = []):
		items = []
		for item in SideBarSelection(paths).getSelectedFiles():
			items.append('*'+item.extension())
		items = uniqueList(items)
		if len(items) > 1:
			return 'In Files With Extensions '+(",".join(items))+u'…'
		elif len(items) > 0:
			return 'In Files With Extension '+(",".join(items))+u'…'
		else:
			return u'In Files With Extension…'