diff options
author | secondlife | 2009-02-24 11:13:04 +0000 |
---|---|---|
committer | secondlife | 2009-02-24 11:13:04 +0000 |
commit | ae0201407c2b741d5b15c2d994ed3ffd8b928676 (patch) | |
tree | c8fb742309e1fa0454af8793ee4abb989a613c93 /auto_source.js | |
parent | 68f378e337bb3c57883745f2b75cdbe35a8e5e03 (diff) | |
download | vimperator-plugins-ae0201407c2b741d5b15c2d994ed3ffd8b928676.tar.bz2 |
add force options
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@30494 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'auto_source.js')
-rw-r--r-- | auto_source.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/auto_source.js b/auto_source.js index f8c83ff..1578780 100644 --- a/auto_source.js +++ b/auto_source.js @@ -26,7 +26,7 @@ var PLUGIN_INFO = - :aso taro.js - :autoso[urce] taro.js - :autoso[urce] -c[ommand] 'colorscheme mycolors' taro.js - - :autoso[urce] -c[ommand] 'js alert("reload!")' taro.js + - :autoso[urce] -c[ommand] -force 'js alert("reload!")' taro.js 監視を中止: - :aso! taro.js - :autoso[urce]! taro.js @@ -64,9 +64,14 @@ var PLUGIN_INFO = return cur.path; } - function startWatching (filepath, command) { - if (exists(filepath)) - throw 'The file has already been watched: ' + filepath; + function startWatching (filepath, command, force) { + if (exists(filepath)) { + if (force) { + killWatcher(filepath); + } else { + throw 'The file has already been watched: ' + filepath; + } + } let last = firstTime ? null : getFileModifiedTime(filepath); let handle = setInterval(function () { try { @@ -100,13 +105,14 @@ var PLUGIN_INFO = ['autoso[urce]', 'aso'], 'Sourcing automatically when the specified file is modified.', function (arg, bang) { - (bang ? killWatcher : startWatching)(expandPath(arg[0]), arg['-command']); + (bang ? killWatcher : startWatching)(expandPath(arg[0]), arg['-command'], arg['-force']); }, { bang: true, argCount: '1', options: [ - [['-command', '-c'], commands.OPTION_STRING] + [['-command', '-c'], commands.OPTION_STRING], + [['-force', '-f'], commands.OPTION_NOARG] ], completer: function (context, args) { if (args.bang) { |