Skip to content

Commit

Permalink
Add option to only include version controlled projects
Browse files Browse the repository at this point in the history
e.g. Git, Mercurial, Subversion

Closes #7
  • Loading branch information
gerardroche committed Sep 15, 2017
1 parent d23e782 commit f329f02
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [1.7.0] - 2017-09-15

### Added

* Added [#7](https://github.com/gerardroche/sublime-open-sesame/issues/7): Option to only include version controlled projects e.g. Git, Mercurial, Subversion

## [1.6.0] - 2017-08-27

### Added
Expand Down Expand Up @@ -174,6 +180,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt

* Initial import

[1.7.0]: https://github.com/gerardroche/sublime-open-sesame/compare/1.6.0...1.7.0
[1.6.0]: https://github.com/gerardroche/sublime-open-sesame/compare/1.5.7...1.6.0
[1.5.7]: https://github.com/gerardroche/sublime-open-sesame/compare/1.5.6...1.5.7
[1.5.6]: https://github.com/gerardroche/sublime-open-sesame/compare/1.5.5...1.5.6
Expand Down
6 changes: 5 additions & 1 deletion Preferences.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@
// // Multiple paths can be set using a `PATH` separator (':' for POSIX
// // or ';' for Windows) e.g. `"~/projects:~/work:~/src"`.
// //
// "open-sesame.path": "~/projects"
// "open-sesame.path": "~/projects",

// Enable include only version controlled projects e.g. Git, Mercurial,
// Subversion.
"open-sesame.vcs": false
}
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Set the location of your projects:

Adding, opening, or switching a project will prompt an overlay for you to select a project.

By default your projects are listed in the format `your/project`.
Projects are listed in the format `x/y` by default:

![Overlay screenshot](screenshot-b.png)

If you prefer to organise your projects at a single level then set the depth to `1`:
If you prefer to organise your projects at a single level then set depth to `1`:

`Preferences > Settings`

Expand All @@ -48,7 +48,7 @@ The preferred method of installation is [Package Control](https://packagecontrol
* Windows: `git clone https://github.com/gerardroche/sublime-open-sesame.git %APPDATA%\Sublime/ Text/ 3/Packages/open-sesame`
3. Done!

## Commands
## COMMANDS

Command Palette | Command | Description
--------------- | ------- | -----------
Expand All @@ -57,7 +57,7 @@ Open Sesame: Open Project | `open_sesame_open_project` | Open a project in a new
Open Sesame: Remove Folder | `open_sesame_remove_folder` | Remove a folder from the current window
Open Sesame: Switch Project | `open_sesame_switch_project` | Add a project to the current window

## Key bindings
## KEY BINDINGS

Windows / Linux | OSX | Description
--------------- | --- | -----------
Expand All @@ -80,13 +80,14 @@ On Ubuntu you may have conflict issues with key bindings such as `ctrl+alt+s` th

$ gsettings set org.gnome.desktop.wm.keybindings toggle-shaded "[]"

## Configuration
## CONFIGURATION

Key | Description | Type | Default
----|-------------|------|--------
`open-sesame.depth` | Number of levels deep to look for projects within projects path. | `1` or `2` | `2`
`open-sesame.keymaps` | Enable the default keymaps. | `boolean` | `true`
`open-sesame.path` | Location of your projects. | `string` | The path found in the environment variable `PROJECTS_PATH` (if it exists).
`open-sesame.vcs` | Include only version controlled projects e.g. Git, Mercurial, Subversion | `boolean` | `false`

### Path

Expand Down Expand Up @@ -140,7 +141,7 @@ Multiple paths can be set using a `PATH` separator (':' for POSIX or ';' for Win

A `PROJECTS_PATH` environment variable can be used to set the default path e.g. on Linux edit `~/.profile` (requires system restart) with `export PROJECTS_PATH=~/projects`.

#### Custom Commands
#### Additional custom commands

Example of creating some custom commands for `~/vendor` path.

Expand Down
12 changes: 12 additions & 0 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,18 @@ def _glob_path(base_path):
if folder_struct not in folders:
folders.append(folder_struct)

if _get_setting('open-sesame.vcs'):
vcs_items = []
vcs_candidates = ['.git', '.hg', '.svn', 'CVS']
for name, path in folders:
for candidate in vcs_candidates:
vcs_marker_file = os.path.join(path, candidate)
if os.path.exists(vcs_marker_file):
vcs_items.append([name, path])
break

folders = vcs_items

return folders


Expand Down

0 comments on commit f329f02

Please sign in to comment.