-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecation notices to legacy commands (#1227)
* Add deprecation notices to legacy commands.
- Loading branch information
Showing
8 changed files
with
55 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/repo/prepare'); | ||
|
||
exports.command = 'ci'; | ||
exports.description = 'Prepare Git repository for CML operations'; | ||
exports.handler = handler; | ||
exports.builder = builder; | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml ci" is deprecated, please use "cml repo prepare"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/asset/publish'); | ||
|
||
exports.command = 'publish <asset>'; | ||
exports.description = false; | ||
exports.handler = handler; | ||
exports.builder = builder; | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml publish" is deprecated, please use "cml asset publish"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/workflow/rerun'); | ||
|
||
exports.command = 'rerun-workflow'; | ||
exports.description = false; | ||
exports.handler = handler; | ||
exports.builder = builder; | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml rerun-workflow" is deprecated, please use "cml workflow rerun"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/comment/create'); | ||
|
||
exports.command = 'send-comment <markdown file>'; | ||
exports.description = false; | ||
exports.handler = handler; | ||
exports.builder = builder; | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml send-comment" is deprecated, please use "cml comment create"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/check/create'); | ||
|
||
exports.command = 'send-github-check <markdown file>'; | ||
exports.description = false; | ||
exports.handler = handler; | ||
exports.builder = builder; | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml send-github-check" is deprecated, please use "cml check create"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/tensorboard/connect'); | ||
|
||
exports.command = 'tensorboard-dev'; | ||
exports.description = false; | ||
exports.handler = handler; | ||
exports.builder = builder; | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: | ||
'"cml tensorboard-dev" is deprecated, please use "cml tensorboard connect"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const winston = require('winston'); | ||
|
||
// addDeprecationNotice adds middleware to the yargs chain to display a deprecation notice. | ||
const addDeprecationNotice = (opts = {}) => { | ||
const { builder, notice } = opts; | ||
return (yargs) => | ||
builder(yargs).middleware([(opts) => deprecationNotice(opts, notice)]); | ||
}; | ||
|
||
const deprecationNotice = (opts, notice) => { | ||
const { cml } = opts; | ||
const driver = cml.getDriver(); | ||
if (driver.warn) { | ||
driver.warn(notice); | ||
} else { | ||
winston.warn(notice); | ||
} | ||
}; | ||
|
||
exports.addDeprecationNotice = addDeprecationNotice; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters